File size: 3,181 Bytes
814113b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
[tool.ruff]
target-version = "py313"

[tool.ruff.lint]
extend-select = [
    "ARG",
    "A",
    "ANN",
    "B",
    "BLE",
    "C4",
    "COM",
    "D",
    "E",
    "EM",
    "EXE",
    "F",
    "FA",
    "FBT",
    "G",
    "I",
    "ICN",
    "INP",
    "INT",
    "ISC",
    "N",
    "NPY",
    "PERF",
    "PGH",
    "PTH",
    "PIE",
    # "PL",
    "PT",
    "Q",
    "RET",
    "RSE",
    "RUF",
    "S",
    # "SLF",
    "SIM",
    "T",
    "TCH",
    "TID",
    "UP",
    "W",
]

# Each rule exclusion should be explained here.
# By default, we think it is better to select groups of rules (above), and exclude
# specific problematic rules, instead of selecting specific rules. By doing so, in case
# the ruff rules groups change, this requires us to check and handle the new rules or
# changes, making sure we stay up to date and keep the best practices.

# ANN003:
# Would mostly apply to args/kwargs that are passed to methods from dependencies, for
# which the signature can change depending on the version. This would either be too
# difficult to comply and/or would add a lot of noqa exceptions. ANN002 is used as it
# adds very few "noqa" exceptions, but ANN003 would add too much complexity.

# ANN101 and ANN102:
# Yields errors for `self` in methods from classes, which is unecessary.
# The existence of these rules is currently questioned, they are likely to be removed.
# https://github.com/astral-sh/ruff/issues/4396

# B905
# The `strict` keyword argument for the `zip` built-in method appeared with Python
# 3.10. As we support previous versions, we cannot comply (yet) with this rule. The
# exclusion should be removed when dropping support for Python 3.9.

# D107
# We document classes at the class level (D101). This documentation should cover the
# way classes are initialized. So we do not document `__init__` methods.

# D203
# "one-blank-line-before-class", incompatible with D211 (blank-line-before-class).
# We follow PEP 257 and other conventions by preferring D211 over D203.

# D212
# "multi-line-summary-first-line", incompatible with D213
# (multi-line-summary-second-line).
# We follow PEP 257, which recommend to set put the summary line on the second line
# after the blank line of the opening quotes.

# FBT001 and FBT002
# Refactoring all the methods to make boolean arguments keyword only would add
# complexity and could break code of users. It's ok to have booleans as positional
# arguments with default values. For code redability though, we enable FB003.

# COM812:
# Yields errors for one-line portions without comma. Trailing commas are automatically
# set with ruff format anyway. This exclusion could be removed when this behavior is
# fixed in ruff.

# UP038
# Recommends to | type union with `isinstance`, which is only supported since Python
# 3.10. The exclusion should be removed when dropping support for Python 3.9.

# (ISC001)
# May cause conflicts when used with the ruff formatter. They recommend to disable it.
# We leave it enabled but keep this in mind.

ignore = [
    "ANN003",
    "ANN101",
    "ANN102",
    "B905",
    "COM812",
    "D107",
    "D203",
    "D212",
    "FBT001",
    "FBT002",
    "UP038",
]