diff options
| author | Simeon Simeonov | 2024-12-28 20:13:43 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2024-12-28 20:13:43 +0100 |
| commit | 82ef6adec6e59f9cc9dc9fa1a13a2b43e534bada (patch) | |
| tree | 5921f91387f8b4567f810c20570f458547e6ae64 /.ruff.toml | |
| parent | e3a82c195f8e18fbd9691845ff4e6121986e13ea (diff) | |
Rename *Exception to *Error and do some general linting
Diffstat (limited to '.ruff.toml')
| -rw-r--r-- | .ruff.toml | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..c5617c1 --- /dev/null +++ b/.ruff.toml | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | cache-dir = "~/.cache/ruff" | ||
| 2 | indent-width = 4 | ||
| 3 | line-length = 79 | ||
| 4 | target-version = "py312" | ||
| 5 | |||
| 6 | [lint] | ||
| 7 | select = ["ALL", "D101", "D102", "D103", "D104"] | ||
| 8 | ignore = [ | ||
| 9 | "ANN", | ||
| 10 | "BLE001", | ||
| 11 | "COM812", | ||
| 12 | "D", | ||
| 13 | "EM101", # Exception must not use a string literal, assign to variable first | ||
| 14 | "EM102", # Exception must not use an f-string literal, assign to variable first | ||
| 15 | "ERA001", | ||
| 16 | "FBT001", | ||
| 17 | "FBT002", | ||
| 18 | "INP001", | ||
| 19 | "ISC001", | ||
| 20 | "N802", | ||
| 21 | "N806", | ||
| 22 | "PLR2004", | ||
| 23 | "PTH111", | ||
| 24 | "RUF012", | ||
| 25 | "RUF013", | ||
| 26 | "S101", | ||
| 27 | "S324", | ||
| 28 | "T201", | ||
| 29 | "TRY003", | ||
| 30 | "TRY300", | ||
| 31 | "UP020" | ||
| 32 | ] | ||
| 33 | |||
| 34 | # D101 - Missing docstring in public class | ||
| 35 | # D102 - Missing docstring in public method | ||
| 36 | # D200 - One-line docstring should fit on one line | ||
| 37 | # D203 - 1 blank line required before class docstring | ||
| 38 | # D205 - 1 blank line required between summary line and description | ||
| 39 | # D403 - First word of the first line should be capitalized: `str` -> `Str` | ||
| 40 | # FBT001 - Boolean-typed positional argument in function definition | ||
| 41 | # FBT002 - Boolean default positional argument in function definition | ||
| 42 | # INP001 - File `beinc_weechat.py` is part of an implicit namespace package. Add an `__init__.py` | ||
| 43 | # N802 - Function name `do_GET` should be lowercase | ||
| 44 | # N806 - Variable `POST_data` in function should be lowercase | ||
| 45 | # PLR2004 - Magic value used in comparison, consider replacing `200` with a constant variable | ||
| 46 | # PTH111 - `os.path.expanduser()` should be replaced by `Path.expanduser()` | ||
| 47 | # PTH113 - `os.path.isfile()` should be replaced by `Path.is_file()` | ||
| 48 | # PTH123 - `open()` should be replaced by `Path.open()` | ||
| 49 | # RUF012 - Mutable class attributes should be annotated with `typing.ClassVar` | ||
| 50 | # RUF013 - PEP 484 prohibits implicit `Optional` | ||
| 51 | # S101 - Use of `assert` detected | ||
| 52 | # S324 - Probable use of insecure hash functions in `hashlib`: `md5` | ||
| 53 | # T201 - `print` found | ||
| 54 | # TRY003 - Avoid specifying long messages outside the exception class | ||
| 55 | # TRY300 - Consider moving this statement to an `else` block | ||
| 56 | # UP020 - Use builtin `open` | ||
| 57 | |||
| 58 | # Allow fix for all enabled rules (when `--fix`) is provided. | ||
| 59 | fixable = ["ALL"] | ||
| 60 | unfixable = [] | ||
| 61 | |||
| 62 | # custom settings | ||
| 63 | [lint.per-file-ignores] | ||
| 64 | "src/otp2289/__main__.py" = ["PTH113", "PTH123"] # "Readability counts" | ||
| 65 | |||
| 66 | |||
| 67 | [format] | ||
| 68 | # Like Black, use double quotes for strings. | ||
| 69 | quote-style = "single" | ||
| 70 | |||
| 71 | # Like Black, indent with spaces, rather than tabs. | ||
| 72 | indent-style = "space" | ||
| 73 | |||
| 74 | # Like Black, respect magic trailing commas. | ||
| 75 | skip-magic-trailing-comma = true | ||
| 76 | |||
| 77 | # Like Black, automatically detect the appropriate line ending. | ||
| 78 | line-ending = "auto" | ||
| 79 | |||
| 80 | # Enable auto-formatting of code examples in docstrings. Markdown, | ||
| 81 | # reStructuredText code/literal blocks and doctests are all supported. | ||
| 82 | # | ||
| 83 | # This is currently disabled by default, but it is planned for this | ||
| 84 | # to be opt-out in the future. | ||
| 85 | docstring-code-format = false | ||
| 86 | |||
| 87 | # Set the line length limit used when formatting code snippets in | ||
| 88 | # docstrings. | ||
| 89 | # | ||
| 90 | # This only has an effect when the `docstring-code-format` setting is | ||
| 91 | # enabled. | ||
| 92 | docstring-code-line-length = "dynamic" | ||
| 93 | |||
| 94 | [lint.flake8-quotes] | ||
| 95 | inline-quotes = "single" | ||
| 96 | |||
| 97 | [lint.isort] | ||
| 98 | split-on-trailing-comma = false | ||
