File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change
1
+ Improve handling of S011 to not warn if the # is '#$' (e.g. shell base arithmetic)
Original file line number Diff line number Diff line change @@ -437,7 +437,7 @@ def check_indentation(line: str) -> bool:
437
437
'evaluate commented lines' : True ,
438
438
FUNCTION : functools .partial (
439
439
check_if_jinja2 ,
440
- function = re .compile (r'(?<!{)#.*?{[{%]' ).findall
440
+ function = re .compile (r'(?<!{)#[^$] .*?{[{%]' ).findall
441
441
)
442
442
},
443
443
'S012' : {
Original file line number Diff line number Diff line change @@ -335,6 +335,12 @@ def test_check_cylc_file_jinja2_comments():
335
335
assert not any ('S011' in msg for msg in lint .messages )
336
336
337
337
338
+ def test_check_cylc_file_jinja2_comments_shell_arithmetic_not_warned ():
339
+ """Jinja2 after a $((10#$variable)) should not warn"""
340
+ lint = lint_text ('#!jinja2\n a = b$((10#$foo+5)) {{ BAR }}' , ['style' ])
341
+ assert not any ('S011' in msg for msg in lint .messages )
342
+
343
+
338
344
@pytest .mark .parametrize (
339
345
# 11 won't be tested because there is no jinja2 shebang
340
346
'number' , set (range (1 , len (MANUAL_DEPRECATIONS ) + 1 )) - {11 }
You can’t perform that action at this time.
0 commit comments