Skip to content

Commit a0f5ec3

Browse files
authored
Clean up ruff ignore list by fixing underlying violations (#6)
* Switch to ruff check and apply best practices for Python packages * Clean up ruff ignores: fix underlying violations and reduce ignore list
1 parent 43d7541 commit a0f5ec3

29 files changed

Lines changed: 335 additions & 439 deletions

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ persistent=yes
8888

8989
# Minimum Python version to use for version dependent checks. Will default to
9090
# the version used to run pylint.
91-
py-version=3.9
91+
py-version=3.10
9292

9393
# Discover python modules and packages in the file system subtree.
9494
recursive=yes

pyproject.toml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,126 @@
7171
[tool.pylama]
7272
max_line_length = 160
7373
skip = "*/.pytest_cache/*, */.tox/*, */mypy_cache/*, ./dist, ./docs"
74+
75+
[tool.ruff]
76+
target-version = "py310"
77+
78+
# Same as Black.
79+
line-length = 160
80+
81+
exclude = [
82+
".bzr",
83+
".direnv",
84+
".eggs",
85+
".git",
86+
".git-rewrite",
87+
".hg",
88+
".mypy_cache",
89+
".nox",
90+
".pants.d",
91+
".pytype",
92+
".ruff_cache",
93+
".svn",
94+
".tox",
95+
".venv",
96+
"__pypackages__",
97+
"_build",
98+
"buck-out",
99+
"build",
100+
"dist",
101+
"node_modules",
102+
"venv",
103+
]
104+
105+
[tool.ruff.lint]
106+
select = [
107+
"AIR",
108+
"FAST",
109+
"YTT",
110+
"ASYNC",
111+
"S1", "S2", "S302", "S303", "S304", "S305", "S306", "S307", "S31", "S32", "S401", "S402", "S406", "S407", "S408", "S409", "S41", "S5", "S601", "S602", "S604", "S605", "S606", "S607", "S609", "S61", "S7",
112+
"FBT",
113+
"B00", "B01", "B020", "B021", "B022", "B023", "B025", "B027", "B028", "B029", "B03", "B901", "B903", "B905", "B911",
114+
"A",
115+
"COM",
116+
"C4",
117+
"DTZ003", "DTZ004", "DTZ012", "DTZ901",
118+
"T10",
119+
"DJ003", "DJ01",
120+
"EM",
121+
"EXE",
122+
"FIX",
123+
"FA",
124+
"INT",
125+
"ISC",
126+
"ICN",
127+
"LOG",
128+
"G001", "G002", "G01", "G1", "G2",
129+
"INP",
130+
"PIE",
131+
"T20",
132+
"PYI",
133+
"PT",
134+
"Q",
135+
"RSE",
136+
"RET",
137+
"SIM",
138+
"SLOT",
139+
"TID",
140+
"TD001", "TD004", "TD005", "TD007",
141+
"TC",
142+
"ARG003", "ARG004", "ARG005",
143+
"PTH",
144+
"FLY",
145+
"I",
146+
"C90",
147+
"NPY",
148+
"PD",
149+
"N803", "N804", "N805", "N811", "N812", "N813", "N814", "N817", "N818", "N999",
150+
"PERF1", "PERF2", "PERF401",
151+
"E",
152+
"W",
153+
"DOC202", "DOC403", "DOC502",
154+
"D2", "D3", "D402", "D403", "D405", "D406", "D407", "D408", "D409", "D410", "D411", "D412", "D413", "D414", "D416",
155+
"F",
156+
"PGH",
157+
"PLC",
158+
"PLE",
159+
"PLR01", "PLR02", "PLR04", "PLR0915", "PLR1711", "PLR1704", "PLR1714", "PLR1716", "PLR172", "PLR173", "PLR2044", "PLR5", "PLR6104", "PLR6201",
160+
"PLW",
161+
"UP",
162+
"FURB",
163+
"RUF",
164+
"TRY003", "TRY004", "TRY2", "TRY300", "TRY401",
165+
]
166+
ignore = [
167+
# ignore for now:
168+
"S101", "N803", "N999", "PLR6201",
169+
"S602", "FBT002", "FBT001", "RUF001", "N812", "PLW0603", "PLW0602",
170+
"PLW2901", "PIE810", "PERF203", "FIX004", "N818",
171+
"RUF067",
172+
# end for now.
173+
"COM812", "D203",
174+
"T201", # print statements are ok
175+
"SIM102",
176+
"RUF012",
177+
"D205",
178+
"FIX002", # TODOs need some love but we will probably not get of them
179+
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible.
180+
"PT028", # experimental rule, incomplete
181+
]
182+
183+
# Allow autofix for all enabled rules (when `--fix`) is provided.
184+
fixable = ["ALL"]
185+
unfixable = []
186+
preview = true
187+
188+
[tool.ruff.lint.per-file-ignores]
189+
190+
[tool.ruff.lint.flake8-boolean-trap]
191+
192+
[tool.ruff.lint.pylint]
193+
max-statements = 234
194+
195+
[tool.ruff.lint.mccabe]
196+
max-complexity = 70 # value is far from perfect (recommended default is 10). But we will try to decrease it over the time.

ruff.toml

Lines changed: 0 additions & 128 deletions
This file was deleted.

testProc.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ def main() -> None:
1717
restart_after_count: int = 100
1818
f = pf.makeHandler(whoisdomain.remoteQ2, restart_after_count)
1919

20-
n = 0
21-
for tld in whoisdomain.validTlds():
22-
n += 1
20+
for n, tld in enumerate(whoisdomain.validTlds(), start=1):
2321
domain = whoisdomain.getTestHint(tld)
2422
domain = domain or f"meta.{tld}"
2523
try:

0 commit comments

Comments
 (0)