mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 20:35:54 +08:00
Merge branch 'Ultimaker:main' into main
This commit is contained in:
commit
19ede5091c
7
.github/workflows/printer-linter-format.yml
vendored
7
.github/workflows/printer-linter-format.yml
vendored
@ -11,6 +11,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
printer-linter-format:
|
printer-linter-format:
|
||||||
|
if: ${{ github.repository_owner == 'Ultimaker' }}
|
||||||
name: Printer linter auto format
|
name: Printer linter auto format
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -35,9 +36,9 @@ jobs:
|
|||||||
if: env.GIT_DIFF && !env.MATCHED_FILES
|
if: env.GIT_DIFF && !env.MATCHED_FILES
|
||||||
run: pip install -r .github/workflows/requirements-printer-linter.txt
|
run: pip install -r .github/workflows/requirements-printer-linter.txt
|
||||||
|
|
||||||
# - name: Format file
|
- name: Format file
|
||||||
# if: env.GIT_DIFF && !env.MATCHED_FILES
|
if: env.GIT_DIFF && !env.MATCHED_FILES
|
||||||
# run: python printer-linter/src/terminal.py --format ${{ env.GIT_DIFF_FILTERED }}
|
run: python printer-linter/src/terminal.py --format ${{ env.GIT_DIFF_FILTERED }}
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
if: env.GIT_DIFF && !env.MATCHED_FILES
|
if: env.GIT_DIFF && !env.MATCHED_FILES
|
||||||
|
@ -43,19 +43,26 @@ class Definition(Linter):
|
|||||||
for key, value_dict in definition["overrides"].items():
|
for key, value_dict in definition["overrides"].items():
|
||||||
is_redefined, value, parent = self._isDefinedInParent(key, value_dict, definition['inherits'])
|
is_redefined, value, parent = self._isDefinedInParent(key, value_dict, definition['inherits'])
|
||||||
if is_redefined:
|
if is_redefined:
|
||||||
redefined = re.compile(r'.*(\"' + key + r'\"[\s\S]*?\{)[\s\S]*?(\}[,\"]?)')
|
redefined = re.compile(r'.*(\"' + key + r'\"[\s\:\S]*?)\{[\s\S]*?\},?')
|
||||||
found = redefined.search(self._content)
|
found = redefined.search(self._content)
|
||||||
|
# TODO: Figure out a way to support multiline fixes in the PR review GH Action, for now suggest no fix to ensure no ill-formed json are created
|
||||||
|
# see: https://github.com/platisd/clang-tidy-pr-comments/issues/37
|
||||||
|
if len(found.group().splitlines()) > 1:
|
||||||
|
replacements = []
|
||||||
|
else:
|
||||||
|
replacements = [Replacement(
|
||||||
|
file = self._file,
|
||||||
|
offset = found.span(1)[0],
|
||||||
|
length = len(found.group()),
|
||||||
|
replacement_text = "")]
|
||||||
|
|
||||||
yield Diagnostic(
|
yield Diagnostic(
|
||||||
file = self._file,
|
file = self._file,
|
||||||
diagnostic_name = "diagnostic-definition-redundant-override",
|
diagnostic_name = "diagnostic-definition-redundant-override",
|
||||||
message = f"Overriding {key} with the same value ({value}) as defined in parent definition: {definition['inherits']}",
|
message = f"Overriding {key} with the same value ({value}) as defined in parent definition: {definition['inherits']}",
|
||||||
level = "Warning",
|
level = "Warning",
|
||||||
offset = found.span(0)[0],
|
offset = found.span(0)[0],
|
||||||
replacements = [Replacement(
|
replacements = replacements
|
||||||
file = self._file,
|
|
||||||
offset = found.span(1)[0],
|
|
||||||
length = found.span(2)[1] - found.span(1)[0],
|
|
||||||
replacement_text = "")]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def _loadDefinitionFiles(self, definition_file) -> None:
|
def _loadDefinitionFiles(self, definition_file) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user