-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathruff.toml
More file actions
121 lines (107 loc) · 3.71 KB
/
ruff.toml
File metadata and controls
121 lines (107 loc) · 3.71 KB
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
116
117
118
119
120
121
include = [
"pyproject.toml",
"benchmarking/**/*.ipynb",
"examples/**/*.py",
"skfp/**/*.py",
"tests/**/*.py",
]
exclude = [
"docs/**"
]
target-version = "py310" # same as the minimal version in pyproject.toml
[lint]
select = ["ALL"]
ignore = [
# groups
"ANN", # use mypy for annotations
"COM", # turn off weird comma rules
"EM", # string messages for exceptions
"FA", # use typing imports
"FBT", # bool arguments
"PTH", # os instead of Pathlib when useful
"RET", # format returns as needed for readability
"T20", # printing allowed
"TC", # type checking linter works really badly
# naming - we allow uppercase letters, e.g. X_train, use_3D
"N802",
"N803",
"N806",
# docstrings - we tailor rules to our own convention
"D100", # no module docstrings
"D104", # no package docstrings
"D107", # no __init__ docstrings
"D200", # always multiline docstrings
"D203", # prefer D211, no blank line between docstring and code
"D205", # no blank line between summary and description
"D212", # start docstrings on second line
"D213", # start docs on next line
"D413", # no empty line after last docstring section
# various other things
"B028", # simple warnings
"C408", # call dict(), list(), set()
"E731", # Lambda expressions
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PGH003", # ignore types where necessary
"PLC0415", # imports inside functions/methods
"PLR2004", # numerical constants
"PLR0913", # many arguments
"PLW2901", # overwrite loop variable for readability
"PT011", # use ValueError
"PYI041", # explicitly mark Union[int, float] for readability
"RUF002", # regular minus sign in docs
"RUF059", # unused variables after unpacking
"RUF012", # mutable class attributes
"SLF001", # use private members
"SIM108", # if/else instead of ternary if when we need
"TRY003", # long error messages
]
[lint.per-file-ignores]
"benchmarking/**.py" = [
"D103", # no docstrings
"INP001", # implicit package
"NPY002", # np.random.seed
"PLR0912", # many branches
"PLR0915", # many statements
]
"examples/**" = [
"D101", # no docstrings in examples
"D103", # no docstrings in examples
]
"skfp/**__init__.py**" = [
"F401", # allow unused imports which shorten import paths
]
"skfp/bases/**.py" = [
"ARG002", # allow unused arguments for scikit-learn compatibility
"D401", # non-imperative descriptions
]
"skfp/descriptors/**.py" = [
"D401", # non-imperative descriptions
]
"tests/**" = [
"ARG001", # unused arguments in scikit-learn tests
"D101", # no docstrings in helper classes
"D103", # no docstrings for tests
"NPY002", # np.random.rand
"PERF203", # exceptions in loops
"PLR1704", # redefine arguments as variables
"PLW0603", # global variables in scikit-learn tests
"PLW2901", # overwriting variables in loops
"PT006", # lists in pytest.mark.parametrize
"PT012", # multiple lines in pytest.raises()
"RUF005", # adding lists
"RUF043", # do not require r-strings in pytest.raises()
"S101", # assert
"S301", # pickle
"S311", # pseudo-random generation
"SIM108", # if-else instead of ternary operations for long lines
"SIM211", # explicit False/True for readability
"TRY004", # AssertionError in tests, not TypeError
]
[lint.pycodestyle]
# formatter will reformat lines to length 88, so we report errors only for
# extremely long lines
max-line-length = 200
[lint.pydocstyle]
convention = "numpy"
[lint.mccabe]
max-complexity = 10 # B in xenon rating