Skip to content

Commit a49b9d0

Browse files
committed
Clean up ruff config for rules both selected and ignored
I already did configure it to use numpy style docstrings, which automatically disables several of the ignored rules (without having to specify) Thus selecting all "D" rules and only ignoring has the same effect, and cleans up the config quite a bit. Additionally, the following rules from the ignore list had only a single occurrence, so I may as well fix that occurrence and enforce the rule: - D207: Docstring is under-indented - just a single missing space in the closing `"""` for one docstring - D403: First word of the first line should be properly capitalized - No occurrences, if no objection to enforcing this going forward, may as well enable - E722: do not use bare except, specify exception instead - single occurence in tests, added a noqa comment (could alternatively add to per file ignore if we wish) Additionally, selecting all pydocstyle (`D`) enabled the previously unselected D419: Docstring is empty. There was a single occurrence of an empty docstring, in scale.py:LinearScale, which has a comment stating that the method is there explicitly to prevent inherited docstring. - noqa comment added, enforcing the rule otherwise The N error codes (enforcing naming conventions) that were included in the ignore list were also never selected (and selecting "N" was rather noisy even with the ignores). These have been removed
1 parent 5d471d6 commit a49b9d0

File tree

4 files changed

+4
-52
lines changed

4 files changed

+4
-52
lines changed

lib/matplotlib/scale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __init__(self, axis):
9898
# constructor docstring, which would otherwise end up interpolated into
9999
# the docstring of Axis.set_scale.
100100
"""
101-
"""
101+
""" # noqa: D419
102102

103103
def set_default_locators_and_formatters(self, axis):
104104
# docstring inherited

lib/matplotlib/tests/test_font_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def test_get_font_names():
317317
font = ft2font.FT2Font(path)
318318
prop = ttfFontProperty(font)
319319
ttf_fonts.append(prop.name)
320-
except:
320+
except: # noqa: E722
321321
pass
322322
available_fonts = sorted(list(set(ttf_fonts)))
323323
mpl_font_names = sorted(fontManager.get_font_names())

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Text3D(mtext.Text):
9191
----------------
9292
**kwargs
9393
All other parameters are passed on to `~matplotlib.text.Text`.
94-
"""
94+
"""
9595

9696
def __init__(self, x=0, y=0, z=0, text='', zdir='z', **kwargs):
9797
mtext.Text.__init__(self, x, y, text, **kwargs)

pyproject.toml

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,68 +33,20 @@ ignore = [
3333
"D104",
3434
"D105",
3535
"D106",
36-
"D107",
3736
"D200",
3837
"D202",
39-
"D203",
4038
"D204",
4139
"D205",
42-
"D207",
43-
"D212",
4440
"D301",
4541
"D400",
4642
"D401",
47-
"D402",
48-
"D403",
4943
"D404",
50-
"D413",
51-
"E722",
5244
"E741",
5345
"F841",
54-
"N801",
55-
"N802",
56-
"N803",
57-
"N806",
58-
"N812",
5946
]
6047
line-length = 88
6148
select = [
62-
"D100",
63-
"D101",
64-
"D102",
65-
"D103",
66-
"D104",
67-
"D105",
68-
"D106",
69-
"D200",
70-
"D201",
71-
"D202",
72-
"D204",
73-
"D205",
74-
"D206",
75-
"D207",
76-
"D208",
77-
"D209",
78-
"D210",
79-
"D211",
80-
"D213",
81-
"D214",
82-
"D215",
83-
"D300",
84-
"D301",
85-
"D400",
86-
"D401",
87-
"D403",
88-
"D404",
89-
"D405",
90-
"D406",
91-
"D407",
92-
"D408",
93-
"D409",
94-
"D410",
95-
"D411",
96-
"D412",
97-
"D414",
49+
"D",
9850
"E",
9951
"F",
10052
"W",

0 commit comments

Comments
 (0)