mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-10 07:15:03 -06:00
Only suggest a fix if it is on a single line
This commit is contained in:
parent
3eb98873a6
commit
dbc0ac1180
1 changed files with 11 additions and 5 deletions
|
@ -45,17 +45,23 @@ class Definition(Linter):
|
|||
if is_redefined:
|
||||
redefined = re.compile(r'.*(\"' + key + r'\"[\s\:\S]*?)\{[\s\S]*?\},?')
|
||||
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
|
||||
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(
|
||||
file = self._file,
|
||||
diagnostic_name = "diagnostic-definition-redundant-override",
|
||||
message = f"Overriding {key} with the same value ({value}) as defined in parent definition: {definition['inherits']}",
|
||||
level = "Warning",
|
||||
offset = found.span(0)[0],
|
||||
replacements = [Replacement(
|
||||
file = self._file,
|
||||
offset = found.span(1)[0],
|
||||
length = len(found.group()),
|
||||
replacement_text = "")]
|
||||
replacements = replacements
|
||||
)
|
||||
|
||||
def _loadDefinitionFiles(self, definition_file) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue