Skip to content

Commit

Permalink
Fix null rule for syntax error
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Rul <mathroule@gmail.com>
  • Loading branch information
mathroule committed Jun 16, 2023
1 parent bc8c67e commit 268c77f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ def check(self, source, conf, **kwargs):
for key in kwargs:
assert key.startswith('problem')
if len(kwargs[key]) > 2:
if kwargs[key][2] == 'syntax':
rule_id = None
else:
rule_id = kwargs[key][2]
rule_id = kwargs[key][2]
else:
rule_id = self.rule_id
expected_problems.append(linter.LintProblem(
Expand Down
3 changes: 2 additions & 1 deletion yamllint/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def get_syntax_error(buffer):
except yaml.error.MarkedYAMLError as e:
problem = LintProblem(e.problem_mark.line + 1,
e.problem_mark.column + 1,
'syntax error: ' + e.problem + ' (syntax)')
'syntax error: ' + e.problem,
'syntax')
problem.level = 'error'
return problem

Expand Down

0 comments on commit 268c77f

Please sign in to comment.