|
1 |
| - |
2 |
| -line-length = 120 |
3 | 1 | indent-width = 4
|
| 2 | +line-length = 120 |
4 | 3 |
|
5 | 4 | target-version = "py38"
|
6 |
| -src = ["src", "test"] |
7 |
| - |
8 |
| -# https://docs.astral.sh/ruff/settings/#ignore-init-module-imports |
9 |
| -ignore-init-module-imports = true |
10 |
| - |
11 |
| -extend-exclude = ["__init__.py"] |
12 |
| - |
13 |
| -select = [ |
14 |
| - "E", "W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w |
15 |
| - "I", # https://docs.astral.sh/ruff/rules/#isort-i |
16 |
| - "UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up |
17 |
| - |
18 |
| - "A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a |
19 |
| - "ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-async-async |
20 |
| - "C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4 |
21 |
| - "EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em |
22 |
| - "FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix |
23 |
| - "INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp |
24 |
| - "ISC", # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc |
25 |
| - "PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie |
26 |
| - "PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt |
27 |
| - "PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth |
28 |
| - "RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret |
29 |
| - "SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim |
30 |
| - "SLOT", # https://docs.astral.sh/ruff/rules/#flake8-slots-slot |
31 |
| - "T10", # https://docs.astral.sh/ruff/rules/#flake8-debugger-t10 |
32 |
| - "TCH", # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch |
33 |
| - "TD", # https://docs.astral.sh/ruff/rules/#flake8-todos-td |
34 |
| - |
35 |
| - "TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try |
36 |
| - "FLY", # https://docs.astral.sh/ruff/rules/#flynt-fly |
37 |
| - "PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf |
38 |
| - "RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf |
39 |
| - |
40 |
| - "PL", # https://docs.astral.sh/ruff/rules/#pylint-pl |
| 5 | + |
| 6 | +src = [ |
| 7 | + "src", |
| 8 | + "tests" |
41 | 9 | ]
|
42 | 10 |
|
| 11 | + |
| 12 | +[lint] |
| 13 | +select = ["ALL"] |
| 14 | + |
43 | 15 | ignore = [
|
| 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 | 23 |
|
47 |
| - "A003", # https://docs.astral.sh/ruff/rules/builtin-attribute-shadowing/ |
| 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 |
48 | 62 | ]
|
49 | 63 |
|
50 | 64 |
|
51 | 65 | [format]
|
52 |
| -# Use single quotes for non-triple-quoted strings. |
53 | 66 | quote-style = "single"
|
54 | 67 |
|
55 | 68 |
|
| 69 | +# https://docs.astral.sh/ruff/settings/#lintflake8-quotes |
| 70 | +[lint.flake8-quotes] |
| 71 | +inline-quotes = "single" |
| 72 | +multiline-quotes = "single" |
56 | 73 |
|
57 |
| -[lint.per-file-ignores] |
58 |
| -"doc/*" = [ |
59 |
| - "A001", # A001 Variable `copyright` is shadowing a Python builtin |
60 |
| - "E402", # E402 Module level import not at top of file |
61 |
| - "INP001", # INP001 File `FILE_NAME` is part of an implicit namespace package. Add an `__init__.py`. |
62 |
| - "PTH100", # PTH100 `os.path.abspath()` should be replaced by `Path.resolve()` |
63 |
| - "PTH118", # PTH118 `os.path.join()` should be replaced by `Path` with `/` operator |
64 |
| -] |
65 | 74 |
|
66 |
| -"tests/*" = [ |
67 |
| - "INP001", # INP001 File `FILE_NAME` is part of an implicit namespace package. Add an `__init__.py`. |
68 |
| - "ISC002", # ISC002 Implicitly concatenated string literals over multiple lines |
69 |
| -] |
| 75 | +[lint.flake8-builtins] |
| 76 | +builtins-ignorelist = ["id", "input"] |
70 | 77 |
|
71 |
| -"setup.py" = ["PTH123"] |
72 | 78 |
|
73 |
| -"src/sphinx_exec_code/code_exec_error.py" = [ |
74 |
| - "PERF401", # PERF401 Use a list comprehension to create a transformed list |
75 |
| - "PLW2901", # PLW2901 `for` loop variable `tb_line` overwritten by assignment target |
76 |
| -] |
| 79 | +# https://docs.astral.sh/ruff/settings/#lintisort |
| 80 | +[lint.isort] |
| 81 | +lines-after-imports = 2 # https://docs.astral.sh/ruff/settings/#lint_isort_lines-after-imports |
77 | 82 |
|
78 | 83 |
|
79 |
| -[lint.isort] |
80 |
| -# https://docs.astral.sh/ruff/settings/#isort-lines-after-imports |
81 |
| -lines-after-imports = 2 |
| 84 | +[lint.per-file-ignores] |
| 85 | +"setup.py" = ["PTH123"] |
82 | 86 |
|
| 87 | +"tests/*" = [ |
| 88 | + "ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann |
| 89 | + |
| 90 | + # https://docs.astral.sh/ruff/rules/#flake8-bandit-s |
| 91 | + "S101", # Use of assert detected |
83 | 92 |
|
84 |
| -[lint.pylint] |
85 |
| -max-args = 6 |
| 93 | + # https://docs.astral.sh/ruff/rules/#refactor-r |
| 94 | + "PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable |
| 95 | + "PLR0913", # Too many arguments in function definition ({c_args} > {max_args}) |
| 96 | +] |
0 commit comments