-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cylc lint - incorrect warnings about jinja2 and comments #5682
Comments
Yeah I guess we need more sophisticated parsing to identify
Also, this message should be a little more explicit, to make it clear we're not talking about Jinja2 comments |
There's only so far we can go with this simple regex linter, suggest demoting this to "INFO" level. |
Yes, a regex linter can't handle all situations very easily. The regex would get ever more complex as new edge cases come up. Without knowing the internals, I know Cylc does something to remove comments in its processing, so could that be leveraged. Instead of removing comments, it extracts and returns them (with a line number reference perhaps), and those are then processed? |
For the linter we need to stick to a simple regex approach as:
We can potentially allow the linter to be a little bit stateful, but we can't run the file through the parsec parser. |
How about we close this issue by simply extending the regex a little to assume that Cylc comments either start at Most of the time that will be true, and it will avoid flagging shell substitution syntax. A few missed positives is better than false positives, and likely inconsequential anyhow. |
You could have two versions. One which assumes as you stated, and is a warning. Another which is stricter but is info, which is off by default, and covers all? #5542 would perhaps help with this topic too, although I do dislike cluttering files with lint directives. |
Also, I don't know all edge cases, but in this one, ignoring #$ would protect against this case I think. |
Closed by #5841 |
Description
The linter incorrectly warns about jinja2 comments, for example if a
#
is in that line even if it isn't a comment.Reproducible Example
Add to an environment section:
Both of the above will output a warning, so it is not a quoted vs unquoted issue.
Expected Behaviour
No warning should be issued because this is valid syntax for shell and the
#
is not a comment for Cylc.The text was updated successfully, but these errors were encountered: