Skip to content

Commit

Permalink
Fix S011 lint
Browse files Browse the repository at this point in the history
Cylc does not parse Jinja2 when inside a Jinja2 comment.
  • Loading branch information
ColemanTom committed May 15, 2023
1 parent 250431c commit d48d9b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cylc/flow/scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
'url': 'https://github.com/cylc/cylc-flow/issues/3825',
'index': 10
},
re.compile(r'#.*?{[{%]'): {
re.compile(r'(?<!{)#.*?{[{%]'): {
'short': 'Cylc will process commented Jinja2!',
'url': '',
'index': 11
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/scripts/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ def test_check_cylc_file_lint(number):
assert_contains(lint.messages, f'S{(number + 1):03d}')


def test_check_cylc_file_jinja2_comments():
# Repalce the '# {{' line to be '{# {{' which should not be a warning
lint = lint_text(LINT_TEST_FILE.replace('# {{', '{# {{'), ['style'])
assert not filter_strings(lint.messages, 'S011')


@pytest.mark.parametrize('exclusion', range(len(STYLE_CHECKS.values())))
def test_check_exclusions(exclusion):
"""It does not report any items excluded."""
Expand Down

0 comments on commit d48d9b5

Please sign in to comment.