summaryrefslogtreecommitdiff
path: root/.ruff.toml
diff options
context:
space:
mode:
Diffstat (limited to '.ruff.toml')
-rw-r--r--.ruff.toml109
1 files changed, 109 insertions, 0 deletions
diff --git a/.ruff.toml b/.ruff.toml
new file mode 100644
index 0000000..1037228
--- /dev/null
+++ b/.ruff.toml
@@ -0,0 +1,109 @@
1cache-dir = "~/.cache/ruff"
2indent-width = 4
3line-length = 79
4target-version = "py39"
5
6[lint]
7select = ["ALL", "D101", "D102", "D103", "D104"]
8ignore = [
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 "T201",
28 "TRY003",
29 "TRY300",
30 "UP020"
31]
32
33# D101 - Missing docstring in public class
34# D102 - Missing docstring in public method
35# D200 - One-line docstring should fit on one line
36# D203 - 1 blank line required before class docstring
37# D205 - 1 blank line required between summary line and description
38# D403 - First word of the first line should be capitalized: `str` -> `Str`
39# FBT001 - Boolean-typed positional argument in function definition
40# FBT002 - Boolean default positional argument in function definition
41# INP001 - File `beinc_weechat.py` is part of an implicit namespace package. Add an `__init__.py`
42# N802 - Function name `do_GET` should be lowercase
43# N806 - Variable `POST_data` in function should be lowercase
44# PTH111 - `os.path.expanduser()` should be replaced by `Path.expanduser()`
45# PLR2004 - Magic value used in comparison, consider replacing `200` with a constant variable
46# RUF012 - Mutable class attributes should be annotated with `typing.ClassVar`
47# RUF013 - PEP 484 prohibits implicit `Optional`
48# S101 - Use of `assert` detected
49# T201 - `print` found
50# TRY003 - Avoid specifying long messages outside the exception class
51# TRY300 - Consider moving this statement to an `else` block
52# UP020 - Use builtin `open`
53
54# Allow fix for all enabled rules (when `--fix`) is provided.
55fixable = ["ALL"]
56unfixable = []
57
58# custom settings
59[lint.per-file-ignores]
60"beinc_generic_client.py" = [
61 "S310" # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected
62]
63"beinc_pull.py" = [
64 "S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected
65 "TRY002", # Create your own exception
66 "TRY301" # Abstract `raise` to an inner function
67]
68"beinc_weechat.py" = [
69 "ARG001", # Unused function argument: `data`
70 "C901", # `beinc_cmd_target_handler` is too complex (13 > 10)
71 "DTZ005", # `datetime.datetime.now()` called without a `tz` argument
72 "PLR0912", # Too many branches (16 > 12)
73 "PLW0603", # Using the global statement to update `global_values` is discouraged
74 "PTH118", # `os.path.join()` should be replaced by `Path` with `/` operator
75 "S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected
76 "TRY002", # Create your own exception
77 "TRY301" # Abstract `raise` to an inner function
78]
79
80
81[format]
82# Like Black, use double quotes for strings.
83quote-style = "single"
84
85# Like Black, indent with spaces, rather than tabs.
86indent-style = "space"
87
88# Like Black, respect magic trailing commas.
89skip-magic-trailing-comma = true
90
91# Like Black, automatically detect the appropriate line ending.
92line-ending = "auto"
93
94# Enable auto-formatting of code examples in docstrings. Markdown,
95# reStructuredText code/literal blocks and doctests are all supported.
96#
97# This is currently disabled by default, but it is planned for this
98# to be opt-out in the future.
99docstring-code-format = false
100
101# Set the line length limit used when formatting code snippets in
102# docstrings.
103#
104# This only has an effect when the `docstring-code-format` setting is
105# enabled.
106docstring-code-line-length = "dynamic"
107
108[lint.flake8-quotes]
109inline-quotes = "single"