|
1 |
| - |
2 |
| -line-length = 120 |
3 | 1 | indent-width = 4
|
| 2 | +line-length = 120 |
| 3 | + |
| 4 | +target-version = "py310" |
4 | 5 |
|
5 |
| -target-version = "py38" |
6 |
| - |
7 |
| -# https://docs.astral.sh/ruff/settings/#ignore-init-module-imports |
8 |
| -ignore-init-module-imports = true |
9 |
| -src = ["src", "test"] |
10 |
| -extend-exclude = ["__init__.py"] |
11 |
| - |
12 |
| -select = [ |
13 |
| - "E", "W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w |
14 |
| - "I", # https://docs.astral.sh/ruff/rules/#isort-i |
15 |
| - "UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up |
16 |
| - |
17 |
| - "A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a |
18 |
| - "ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-async-async |
19 |
| - "C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4 |
20 |
| - "EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em |
21 |
| - "FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix |
22 |
| - "INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp |
23 |
| - "ISC", # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc |
24 |
| - "PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie |
25 |
| - "PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt |
26 |
| - "PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth |
27 |
| - "RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret |
28 |
| - "SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim |
29 |
| - "SLOT", # https://docs.astral.sh/ruff/rules/#flake8-slots-slot |
30 |
| - "T10", # https://docs.astral.sh/ruff/rules/#flake8-debugger-t10 |
31 |
| - "TCH", # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch |
32 |
| - "TD", # https://docs.astral.sh/ruff/rules/#flake8-todos-td |
33 |
| - |
34 |
| - "TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try |
35 |
| - "FLY", # https://docs.astral.sh/ruff/rules/#flynt-fly |
36 |
| - "PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf |
37 |
| - "RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf |
38 |
| - |
39 |
| - "PL", # https://docs.astral.sh/ruff/rules/#pylint-pl |
| 6 | +src = [ |
| 7 | + "src", |
| 8 | + "tests" |
40 | 9 | ]
|
41 | 10 |
|
| 11 | + |
| 12 | +[lint] |
| 13 | +select = ["ALL"] |
| 14 | + |
42 | 15 | ignore = [
|
43 |
| - "A003", # https://docs.astral.sh/ruff/rules/builtin-attribute-shadowing/ |
| 16 | + "D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d |
| 17 | + "T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20 |
| 18 | + "DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz |
| 19 | + "SLF", # https://docs.astral.sh/ruff/rules/#flake8-self-slf |
| 20 | + |
44 | 21 | "RET501", # https://docs.astral.sh/ruff/rules/unnecessary-return-none/#unnecessary-return-none-ret501
|
45 | 22 | "TRY400", # https://docs.astral.sh/ruff/rules/error-instead-of-exception/
|
46 |
| - "PLR1711", # https://docs.astral.sh/ruff/rules/useless-return/ |
| 23 | + |
| 24 | + # https://docs.astral.sh/ruff/rules/#flake8-builtins-a |
| 25 | + "A003", # Python builtin is shadowed by class attribute {name} from {row} |
| 26 | + |
| 27 | + # https://docs.astral.sh/ruff/rules/#pyflakes-f |
| 28 | + "F401", # {name} imported but unused; consider using importlib.util.find_spec to test for availability |
| 29 | + |
| 30 | + # https://docs.astral.sh/ruff/rules/#flake8-bandit-s |
| 31 | + "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes |
| 32 | + |
| 33 | + # https://docs.astral.sh/ruff/rules/#pyupgrade-up |
| 34 | + "UP038", # Use X | Y in {} call instead of (X, Y) |
| 35 | + |
| 36 | + # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann |
| 37 | + "ANN101", # Missing type annotation for {name} in method |
| 38 | + "ANN102", # Missing type annotation for {name} in classmethod |
| 39 | + "ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name} |
| 40 | + |
| 41 | + # https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble |
| 42 | + "BLE001", # Do not catch blind exception: {name} |
| 43 | + |
| 44 | + # https://docs.astral.sh/ruff/rules/#flake8-raise-rse |
| 45 | + "RSE102", # Unnecessary parentheses on raised exception |
| 46 | + |
| 47 | + # https://docs.astral.sh/ruff/rules/#flake8-commas-com |
| 48 | + "COM812", # Trailing comma missing |
| 49 | + "COM819", # Trailing comma prohibited |
| 50 | + |
| 51 | + # https://docs.astral.sh/ruff/rules/#warning-w_1 |
| 52 | + "PLW0603", # Using the global statement to update {name} is discouraged |
| 53 | + |
| 54 | + # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g |
| 55 | + "G004", # Logging statement uses f-string |
| 56 | + |
| 57 | + # https://docs.astral.sh/ruff/rules/#refactor-r |
| 58 | + "PLR1711", # Useless return statement at end of function |
| 59 | + |
| 60 | + # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf |
| 61 | + "RUF005", # Consider {expression} instead of concatenation |
| 62 | + |
| 63 | + # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt |
| 64 | + "PT007", # Wrong values type in @pytest.mark.parametrize expected {values} of {row} |
47 | 65 | ]
|
48 | 66 |
|
49 | 67 |
|
50 | 68 | [format]
|
51 |
| -# Use single quotes for non-triple-quoted strings. |
52 | 69 | quote-style = "single"
|
53 | 70 |
|
54 | 71 |
|
55 |
| -[lint.per-file-ignores] |
56 |
| -"docs/*" = [ |
57 |
| - "A001", # A001 Variable `copyright` is shadowing a Python builtin |
58 |
| - "E402", # E402 Module level import not at top of file |
59 |
| - "INP001", # INP001 File `FILE_NAME` is part of an implicit namespace package. Add an `__init__.py`. |
60 |
| -] |
| 72 | +# https://docs.astral.sh/ruff/settings/#lintflake8-quotes |
| 73 | +[lint.flake8-quotes] |
| 74 | +inline-quotes = "single" |
| 75 | +multiline-quotes = "single" |
61 | 76 |
|
62 |
| -"tests/*" = [ |
63 |
| - "INP001", # INP001 File `FILE_NAME` is part of an implicit namespace package. Add an `__init__.py`. |
64 |
| - "ISC002", # ISC002 Implicitly concatenated string literals over multiple lines |
65 |
| - "PLR2004", # PLR2004 Magic value used in comparison, consider replacing 5 with a constant variable |
| 77 | + |
| 78 | +[lint.flake8-builtins] |
| 79 | +builtins-ignorelist = ["id", "input"] |
| 80 | + |
| 81 | + |
| 82 | +# https://docs.astral.sh/ruff/settings/#lintisort |
| 83 | +[lint.isort] |
| 84 | +lines-after-imports = 2 # https://docs.astral.sh/ruff/settings/#lint_isort_lines-after-imports |
| 85 | + |
| 86 | + |
| 87 | +[lint.per-file-ignores] |
| 88 | +"docs/conf.py" = [ |
| 89 | + "INP001", # File `conf.py` is part of an implicit namespace package. Add an `__init__.py`. |
| 90 | + "A001", # Variable `copyright` is shadowing a Python builtin |
| 91 | + "PTH118", # `os.path.join()` should be replaced by `Path` with `/` operator |
| 92 | + "PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()` |
66 | 93 | ]
|
67 | 94 |
|
68 | 95 | "setup.py" = ["PTH123"]
|
69 |
| -"src/easyconfig/yaml/from_model.py" = ["PLR0911"] # PLR0911 Too many return statements (7 > 6) |
70 | 96 |
|
| 97 | +"tests/*" = [ |
| 98 | + "ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann |
71 | 99 |
|
| 100 | + # https://docs.astral.sh/ruff/rules/#flake8-bandit-s |
| 101 | + "S101", # Use of assert detected |
72 | 102 |
|
73 |
| -[lint.isort] |
74 |
| -# https://docs.astral.sh/ruff/settings/#isort-lines-after-imports |
75 |
| -lines-after-imports = 2 |
| 103 | + # https://docs.astral.sh/ruff/rules/#refactor-r |
| 104 | + "PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable |
| 105 | + "PLR0913", # Too many arguments in function definition ({c_args} > {max_args}) |
| 106 | +] |
0 commit comments