-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
116 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,17 @@ | ||
# configuration for pre-commit git hooks | ||
|
||
repos: | ||
- repo: https://github.com/asottile/reorder_python_imports | ||
rev: v3.0.1 | ||
hooks: | ||
- id: reorder-python-imports | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.32.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py36-plus] | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.277 | ||
hooks: | ||
- id: flake8 | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.2.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: debug-statements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,122 @@ | ||
[tool.pytest.ini_options] | ||
testpaths = ["tests"] | ||
addopts = ["-v", "-l", "--color=yes", "--code-highlight=yes"] | ||
|
||
[tool.black] | ||
line-length = 99 | ||
line-length = 100 | ||
skip-string-normalization = true | ||
target-version = ["py310", "py311"] | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
/( | ||
\.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.venv | ||
| _build | ||
| buck-out | ||
| build | ||
| dist | ||
| tests/data | ||
)/ | ||
''' | ||
|
||
[tool.ruff] | ||
target-version = "py311" | ||
fixable = ["ALL"] | ||
|
||
select = [ | ||
"B002", # Python does not support the unary prefix increment | ||
"B007", # Loop control variable {name} not used within loop body | ||
"B009", # Do not call getattr with a constant attribute value | ||
"B010", # Do not call setattr with a constant attribute value | ||
"B011", # Do not `assert False`, raise `AssertionError` instead | ||
"B013", # Redundant tuple in exception handler | ||
"B014", # Exception handler with duplicate exception | ||
"B023", # Function definition does not bind loop variable {name} | ||
"B026", # Star-arg unpacking after a keyword argument is strongly discouraged | ||
"BLE001", # Using bare except clauses is prohibited | ||
"C", # complexity | ||
"C4", # flake8-comprehensions | ||
"COM818", # Trailing comma on bare tuple prohibited | ||
# "D", # docstrings | ||
"E", # pycodestyle | ||
"F", # pyflakes/autoflake | ||
"G", # flake8-logging-format | ||
"I", # isort | ||
"ISC001", # Implicitly concatenated string literals on one line | ||
"N804", # First argument of a class method should be named cls | ||
"N805", # First argument of a method should be named self | ||
"N815", # Variable {name} in class scope should not be mixedCase | ||
"N999", # Invalid module name: '{name}' | ||
"PERF", # Perflint rules | ||
"PGH004", # Use specific rule codes when using noqa | ||
"PLC0414", # Useless import alias. Import alias does not rename original package. | ||
"PLC", # pylint | ||
"PLE", # pylint | ||
"PLR", # pylint | ||
"PLW", # pylint | ||
"RUF", # Ruff-specific rules | ||
"S103", # bad-file-permissions | ||
"S108", # hardcoded-temp-file | ||
"S110", # try-except-pass | ||
"S112", # try-except-continue | ||
"S306", # suspicious-mktemp-usage | ||
"S307", # suspicious-eval-usage | ||
"S601", # paramiko-call | ||
"S602", # subprocess-popen-with-shell-equals-true | ||
"S604", # call-with-shell-equals-true | ||
"S609", # unix-command-wildcard-injection | ||
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass | ||
"SIM117", # Merge with-statements that use the same scope | ||
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys() | ||
"SIM201", # Use {left} != {right} instead of not {left} == {right} | ||
"SIM208", # Use {expr} instead of not (not {expr}) | ||
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a} | ||
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'. | ||
"SIM401", # Use get from dict with default instead of an if block | ||
"T100", # Trace found: {name} used | ||
"T20", # flake8-print | ||
"TRY004", # Prefer TypeError exception for invalid type | ||
"TRY200", # Use raise from to specify exception cause | ||
"TRY302", # Remove exception handler; error is immediately re-raised | ||
"PLR0911", # Too many return statements ({returns} > {max_returns}) | ||
"PLR0912", # Too many branches ({branches} > {max_branches}) | ||
"PLR0915", # Too many statements ({statements} > {max_statements}) | ||
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable | ||
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target | ||
"UP", # pyupgrade | ||
"W", # pycodestyle | ||
] | ||
|
||
ignore = [ | ||
"ANN", # flake8-annotations | ||
"D203", # 1 blank line required before class docstring | ||
"D213", # Multi-line docstring summary should start at the second line | ||
"D406", # Section name should end with a newline | ||
"D407", # Section name underlining | ||
"E501", # line too long | ||
"E731", # do not assign a lambda expression, use a def | ||
"PGH001", # No builtin eval() allowed | ||
"PLR0913", # Too many arguments to function call ({c_args} > {max_args}) | ||
"PLW0603", # Using the global statement | ||
"RUF012", # Mutable class attributes should be annotated with typing.ClassVar | ||
"D107", # Missing docstring in __init__ | ||
] | ||
|
||
[tool.ruff.per-file-ignores] | ||
# Allow pprint for docs formatting | ||
"docs/create_*.py" = ["T203"] | ||
|
||
[tool.ruff.flake8-pytest-style] | ||
fixture-parentheses = false | ||
|
||
[tool.ruff.isort] | ||
force-sort-within-sections = true | ||
known-first-party = [ | ||
"broker", | ||
] | ||
combine-as-imports = true | ||
|
||
[tool.ruff.mccabe] | ||
max-complexity = 25 | ||
|
||
[tool.coverage.run] | ||
omit = ["tests/*"] | ||
include = ["nailgun/*.py"] |