Skip to content

Commit

Permalink
chore: Adapt ruff config to new structure (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonagestam authored Sep 22, 2024
1 parent c710c67 commit 5a5eea6
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 68 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ recursive-include src py.typed
exclude *.yaml
exclude *.yml
exclude *.txt
exclude ruff.toml
include README.md
include LICENSE
exclude generate-currencies.py
Expand Down
68 changes: 0 additions & 68 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,73 +92,5 @@ testpaths = ["tests", "src"]
addopts = "--doctest-modules"


[tool.ruff]
fix = true
target-version = "py310"
extend-select = [
# bugbear
"B",
# comprehensions
"C4",
# mccabe
"C90",
# bandit
"S",
# blind exception
# Bare excepts are caught without this, but this also catches `except Exception: ...`.
"BLE",
# builtins
"A",
# Enforce valid noqa comments.
"RUF100",
# isort
"I",
# pycodestyle
"W",
# pyupgrade
"UP",
# debugger
"T10",
# print
"T20",
# quotes
"Q",
# simplify
"SIM",
# tidy imports
# We use this to only outlaw relative _parent_ imports, other relative imports are OK.
"TID",
]
extend-ignore = [
# There's no reason to outlaw asserts.
# https://stackoverflow.com/a/68429294/1220706
"S101",
# Ignore line-length. This is enforced by black, but all cases cannot be handled.
# Ideally we'd only suppress this in generated files.
"E501",
# Allow function calls in argument defaults.
"B008",
]

[tool.ruff.isort]
force-single-line = true
known-first-party = ["immoney", "tests"]

[tool.ruff.mccabe]
max-complexity = 10

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "parents"

[tool.ruff.extend-per-file-ignores]
"tests/*" = [
# Cryptographically safe usage of PRNGs is not relevant in tests.
"S311",
# "Yoda conditions are discouraged", this is dangerous to apply in tests, as it
# destroys some cases that are designed to tests bi-directional equality.
"SIM300",
]


[tool.check-manifest]
ignore = ["src/immoney/_version.py"]
67 changes: 67 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
fix = true
target-version = "py310"

[lint]
extend-select = [
# bugbear
"B",
# comprehensions
"C4",
# mccabe
"C90",
# bandit
"S",
# blind exception
# Bare excepts are caught without this, but this also catches `except Exception: ...`.
"BLE",
# builtins
"A",
# Enforce valid noqa comments.
"RUF100",
# isort
"I",
# pycodestyle
"W",
# pyupgrade
"UP",
# debugger
"T10",
# print
"T20",
# quotes
"Q",
# simplify
"SIM",
# tidy imports
# We use this to only outlaw relative _parent_ imports, other relative imports are OK.
"TID",
]
extend-ignore = [
# There's no reason to outlaw asserts.
# https://stackoverflow.com/a/68429294/1220706
"S101",
# Ignore line-length. This is enforced by black, but all cases cannot be handled.
# Ideally we'd only suppress this in generated files.
"E501",
# Allow function calls in argument defaults.
"B008",
]

[lint.isort]
force-single-line = true
known-first-party = ["immoney", "tests"]

[lint.mccabe]
max-complexity = 10

[lint.flake8-tidy-imports]
ban-relative-imports = "parents"

[lint.extend-per-file-ignores]
"tests/*" = [
# Cryptographically safe usage of PRNGs is not relevant in tests.
"S311",
# "Yoda conditions are discouraged", this is dangerous to apply in tests, as it
# destroys some cases that are designed to tests bi-directional equality.
"SIM300",
]

0 comments on commit 5a5eea6

Please sign in to comment.