Lint.jl
Lint.jl copied to clipboard
Ignoring warnings
I would like to be able to ignore an error on a particular line without having to include Lint.jl or add more code to my src code. I propose we add support for # noqa comments to ignore errors on a given line (like flake8 does). We could also add support for choosing what errors to ignore.
if true | false end # noqa: W442
After the # noqa the code can have a : followed by a comma separated list of warnings to ignore.
Another thing that would be useful is if you could give lint hints in comments. For example if you know the variables mike, tony and verb will be defined for a given file or after a macro defines them than you could use something like the following to tell lint the are declared.
# Lint: declare: mike,tony,verb
And maybe file level ignores, comments to ignore an error for an entire file.
# Lint: noqa: W442,
I would do this by reading through the actual file after linting the parsed file and filtering out the offending errors.
I would also like to deprecate the @lintpragma("Ignore") feature.
It would be good to have others opinions, especially on the syntax.
@TotalVerb @tonyhffong Any thoughts? Or recommendations for syntax?
- Maybe. Ideally it would need the ast to preserve comments to make it easier to implement
- I don't understand why lintpragma is undesirable.
- I prefer not to make message suppression too "easy". It points to a use case issue or a Lint issue, or both.
I find @lintpragma extremely cumbersome and found myself craving a # noqa many times since I started using Lint.jl. This is sometimes a language issue and sometimes a lint issue. But until such issues are fixed (sometimes never) they represent a huge pain. And then sometimes it is use, but I just want to not care.