From 5a5eea606988bbe7461e713cc3f9897a2a453eab Mon Sep 17 00:00:00 2001 From: Anton Agestam Date: Sun, 22 Sep 2024 12:54:54 +0200 Subject: [PATCH] chore: Adapt ruff config to new structure (#110) --- MANIFEST.in | 1 + pyproject.toml | 68 -------------------------------------------------- ruff.toml | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 68 deletions(-) create mode 100644 ruff.toml diff --git a/MANIFEST.in b/MANIFEST.in index 228cd17..7eb3b6b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 726ab5d..167fa7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..fd288e4 --- /dev/null +++ b/ruff.toml @@ -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", +]