-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add ruff Python linter and suppress reported issues #1099
Conversation
…kages in PyCharm Signed-off-by: Jakub Stejskal <[email protected]> Signed-off-by: Jiri Daněk <[email protected]>
* [Ruff: a fast Python linter](https://lwn.net/Articles/930487/) * [Ruff: The First 200 Releases](https://notes.crmarsh.com/ruff-the-first-200-releases) Even though ruff is not as good a linter as Pylint, it is still quite good and is _much_ faster: ``` $ time pylint ods_ci real 0m10.980s, user 0m10.745s, sys 0m0.179s $ time ruff ods_ci real 0m0.023s, user 0m0.040s, sys 0m0.017s ``` Signed-off-by: Jiri Daněk <[email protected]>
Robot Results
|
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
This PR originally comes from an older draft. I am splitting it into three PRs. This PR is second in the series. It adds the linter as a dev dependency, configuration for it, and github action for it. I will send a PR that fixes the found issues after this PR is merged. It follows up on this other PR (which should be merged first) |
# TODO(jdanek) | ||
"C416", # Unnecessary `list` comprehension (rewrite using `list()`) | ||
"E117", # Over-indented | ||
"E231", # Missing whitespace after ',' | ||
"E401", # Multiple imports on one line | ||
"E402", # Module level import not at top of file | ||
"E711", # Comparison to `None` should be `cond is not None` | ||
"E712", # Comparison to `True` should be `cond is True` or `if cond:` | ||
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks | ||
"E722", # Do not use bare `except` | ||
"F401", # `re` imported but unused | ||
"F403", # `from python_terraform import *` used; unable to detect undefined names | ||
"F405", # `IsNotFlagged` may be undefined, or defined from star imports | ||
"F541", # f-string without any placeholders | ||
"F811", # Redefinition of unused `hide_values_in_op_json` from line 565 | ||
"F821", # Undefined name `os` | ||
"PIE790", # Unnecessary `pass` statement | ||
"PLR1714", # Consider merging multiple comparisons. Use a `set` if the elements are hashable. | ||
"Q004", # Unnecessary escape on inner quote character | ||
"RET507", # Unnecessary `else` after `continue` statement | ||
"RET508", # Unnecessary `elif` after `break` statement | ||
"W292", # No newline at end of file | ||
"W293", # Blank line contains whitespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll send a subsequent PR(s) to fix all this.
Even though ruff is not as good a linter as Pylint, it is still quite good and is much faster: