-
Notifications
You must be signed in to change notification settings - Fork 36
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
Feature/SK-736 | Ruff linter #552
Changes from 1 commit
448e3e7
276c9e7
60f9382
7027d20
81f41ff
f3fd13c
ac87c09
0889f42
28612e9
0ff77e4
b6bf066
2a2ca70
b78ae9d
88c0d30
27b940e
26c41e5
769fd6a
1169f15
d426042
a3b338c
106ec8d
d8d0443
69b6693
6762531
7768adb
e2d29c3
daa0c62
c379889
709c0a7
3730f77
ced7da9
0baf159
a5855ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
viktorvaladi marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
lint = ["ruff>=0.0.220"] # MIT License (MIT) | ||
|
||
[tool.ruff] | ||
line-length = 160 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is not this very high number? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, its a very high number, but it's the one that was used on the earlier setup. I think we should lower it in the future There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which earlier setup? We have always used 79 (pep8) |
||
target-version = "py39" | ||
|
||
lint.select = [ | ||
"ANN", # flake8-annotations | ||
"ARG", # flake8-unused-arguments | ||
"B", # flake8-bugbear | ||
"C4", # flake8-comprehensions | ||
"C90", # mccabe | ||
"D", # pydocstyle | ||
"DTZ", # flake8-datetimez | ||
"E", # pycodestyle | ||
"ERA", # eradicate | ||
"F", # Pyflakes | ||
"I", # isort | ||
"N", # pep8-naming | ||
"PD", # pandas-vet | ||
"PGH", # pygrep-hooks | ||
"PLC", # Pylint | ||
"PLE", # Pylint | ||
"PLR", # Pylint | ||
"PLW", # Pylint | ||
"PT", # flake8-pytest-style | ||
"Q", # flake8-quotes | ||
"RET", # flake8-return | ||
"S", # flake8-bandit | ||
"SIM", # flake8-simplify | ||
"T20", # flake8-print | ||
"TID", # flake8-tidy-imports | ||
"W", # pycodestyle | ||
] | ||
|
||
exclude = [ | ||
".venv", | ||
".mnist-keras", | ||
".mnist-pytorch", | ||
"fedn_pb2.py", | ||
"fedn_pb2_grpc.py", | ||
".ci", | ||
"test*" | ||
] | ||
|
||
lint.ignore = [ | ||
"ANN002", # Missing type annotation for *args | ||
"ANN003", # Missing type annotation for **kwargs | ||
"ANN101", # Missing type annotation for self in method | ||
"ANN102", # Missing type annotation for cls in method | ||
"D107", # Missing docstring in __init__ | ||
"D100", # Missing docstring in public module | ||
"D200", # One-line docstring should fit on one line with quotes | ||
"D210", # [*] No whitespaces allowed surrounding docstring text (100+) | ||
"D104", # Missing docstring in public package (17) | ||
"ANN201", # Missing return type annotation for public function (100+) | ||
"ANN001", # Missing type annotation for function argument (100+) | ||
"RET504", # Unnecessary assignment to `settings` before `return` statement (72) | ||
"ANN204", # Missing return type annotation for special method `__init__` (61) | ||
"D205", # 1 blank line required between summary line and description (100+) | ||
"T201", # `print` found (31) | ||
"SIM401", # Use `result.get("id", "")` instead of an `if` block (72) | ||
"D400", # First line should end with a period (80) | ||
"D415", # First line should end with a period, question mark, or exclamation point (80) | ||
"D101", # Missing docstring in public class (30) | ||
"S113", # Probable use of requests call without timeout (41) | ||
"PLR2004", # Magic value used in comparison, consider replacing `200` with a constant variable | ||
"PLR0913", # Too many arguments in function definition (31) | ||
"ANN202", # Missing return type annotation for private function (41) | ||
"D102", # Missing docstring in public method (64) | ||
"SIM108", # Use ternary operator instead of `if`-`else`-block (20) | ||
"RET505", # Unnecessary `else` after `return` statement (20) | ||
"D103", # Missing docstring in public function (17) | ||
"D401", # First line of docstring should be in imperative mood (24) | ||
"N818", # Exception name should be named with an Error suffix (8) | ||
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling (11) | ||
"DTZ005", # The use of `datetime.datetime.now()` without `tz` argument is not allowed (18) | ||
"ANN206", # Missing return type annotation for classmethod (1) | ||
"S110", # `try`-`except`-`pass` detected, consider logging the exception (3) | ||
"N803", # Argument name should be lowercase | ||
"N805", # First argument of a method should be named `self` | ||
"SIM118", # Use `key in dict` instead of `key in dict.keys()` | ||
"SIM115", # Use context handler for opening files | ||
"B027", # `StateStoreBase.__init__` is an empty method in an abstract base class, but has no abstract decorator | ||
"ARG002", # Unused method argument: `use_typing` | ||
"B006", # Do not use mutable data structures for argument defaults | ||
"PLR1714", # Consider merging multiple comparisons: `retcheck in ("", " ")`. Use a `set` if the elements are hashable. | ||
"ERA001", # Found commented-out code | ||
"N802", # Function name should be lowercase | ||
"SIM116", # Use a dictionary instead of consecutive `if` statements | ||
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value | ||
"PLR0911", # Too many return statements (11 > 6) | ||
"C901", # function is too complex (11 > 10) | ||
"ARG001", # Unused function argument: | ||
"SIM105", # Use `contextlib.suppress(KeyError)` instead of `try`-`except`-`pass` | ||
"PLR0915", # Too many statements | ||
"B024", # `Config` is an abstract base class, but it has no abstract methods | ||
"RET506", # Unnecessary `else` after `raise` statement | ||
"N804", # First argument of a class method should be named `cls` | ||
"S202", # Uses of `tarfile.extractall()` | ||
"PLR0912", # Too many branches | ||
"SIM211", # Use `not ...` instead of `False if ... else True` | ||
"D404", # First word of the docstring should not be "This" | ||
"PLW0603", # Using the global statement to update ... is discouraged | ||
"D105", # Missing docstring in magic method | ||
"PLR1722", # Use `sys.exit()` instead of `exit` | ||
"C408", # Unnecessary `dict` call (rewrite as a literal) | ||
"DTZ007", # The use of `datetime.datetime.strptime()` without %z must be followed by `.replace(tzinfo=)` or `.astimezone()` | ||
"PLW2901", # `for` loop variable `val` overwritten by assignment target | ||
"D419", # Docstring is empty | ||
"C416", # Unnecessary `list` comprehension (rewrite using `list()`) | ||
"SIM102", # Use a single `if` statement instead of nested `if` statements | ||
"PLW1508", # Invalid type for environment variable default; expected `str` or `None` | ||
"B007", # Loop control variable `v` not used within loop body | ||
"N806", # Variable `X_test` in function should be lowercase | ||
|
||
# solved with --fix | ||
"Q000", # [*] Single quotes found but double quotes preferred | ||
"D212", # [*] Multi-line docstring summary should start at the first line | ||
"D213", # [*] Multi-line docstring summary should start at the second line | ||
"D202", # [*] No blank lines allowed after function docstring (found 1) | ||
"D209", # [*] Multi-line docstring closing quotes should be on a separate line | ||
"D204", # [*] 1 blank line required after class docstring | ||
"SIM114", # [*] Combine `if` branches using logical `or` operator | ||
"D208", # [*] Docstring is over-indented | ||
"I001", # [*] Import block is un-sorted or un-formatted | ||
"SIM103", # Return the condition directly | ||
"PLR5501", # [*] Use `elif` instead of `else` then `if`, to reduce indentation | ||
"RET501", # [*] Do not explicitly `return None` in function if it is the only possible return value | ||
"PLW0120", # [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | ||
|
||
# unsafe? | ||
"S104", # Possible binding to all interfaces | ||
|
||
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes | ||
"S501", # Probable use of `requests` call with `verify=False` disabling SSL certificate checks | ||
"S108", # Probable insecure usage of temporary file or directory: "/tmp/models" | ||
"S603", # `subprocess` call: check for execution of untrusted input | ||
] |
This file was deleted.
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.
lets try python 3.11 here