Skip to content

Commit 64e7ba5

Browse files
Enable the entire pycodestyle category (#11820)
Co-authored-by: Adam Turner <[email protected]>
1 parent 772ebbc commit 64e7ba5

File tree

6 files changed

+31
-80
lines changed

6 files changed

+31
-80
lines changed

.ruff.toml

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ exclude = [
1515
"doc/usage/extensions/example*.py",
1616
]
1717
ignore = [
18+
# pycodestyle
19+
"E741", # Ambiguous variable name: `{name}`
1820
# pylint
1921
"PLC1901", # simplify truthy/falsey string comparisons
2022
]
@@ -112,58 +114,7 @@ select = [
112114
"DTZ011", # The use of `datetime.date.today()` is not allowed, use `datetime.datetime.now(tz=).date()` instead
113115
"DTZ012", # The use of `datetime.date.fromtimestamp()` is not allowed, use `datetime.datetime.fromtimestamp(ts, tz=).date()` instead
114116
# pycodestyle ('E')
115-
"E101", # Indentation contains mixed spaces and tabs
116-
"E111", # Indentation is not a multiple of {indent_size}
117-
"E112", # Expected an indented block
118-
"E113", # Unexpected indentation
119-
"E114", # Indentation is not a multiple of {indent_size} (comment)
120-
"E115", # Expected an indented block (comment)
121-
"E116", # Unexpected indentation (comment)
122-
"E117", # Over-indented (comment)
123-
"E201", # Whitespace after '{symbol}'
124-
"E202", # Whitespace before '{symbol}'
125-
"E203", # Whitespace before '{symbol}'
126-
"E211", # Whitespace before '{bracket}'
127-
"E221", # Multiple spaces before operator
128-
"E222", # Multiple spaces after operator
129-
"E223", # Tab before operator
130-
"E224", # Tab after operator
131-
"E225", # Missing whitespace around operator
132-
"E226", # Missing whitespace around arithmetic operator
133-
"E227", # Missing whitespace around bitwise or shift operator
134-
"E228", # Missing whitespace around modulo operator
135-
"E231", # Missing whitespace after '{token}'
136-
"E241", # Multiple spaces after comma
137-
"E242", # Tab after comma
138-
# "E251", # Unexpected spaces around keyword / parameter equals
139-
"E252", # Missing whitespace around parameter equals
140-
"E261", # Insert at least two spaces before an inline comment
141-
"E262", # Inline comment should start with `# `
142-
"E265", # Block comment should start with `# `
143-
"E266", # Too many leading `#` before block comment
144-
"E271", # Multiple spaces after keyword
145-
"E272", # Multiple spaces before keyword
146-
"E273", # Tab after keyword
147-
"E274", # Tab before keyword
148-
"E275", # Missing whitespace after keyword
149-
"E401", # Multiple imports on one line
150-
"E402", # Module level import not at top of file
151-
"E501", # Line too long ({width} > {limit} characters)
152-
"E701", # Multiple statements on one line (colon)
153-
"E702", # Multiple statements on one line (semicolon)
154-
"E703", # Statement ends with an unnecessary semicolon
155-
"E711", # Comparison to `None` should be `cond is None`
156-
"E712", # Comparison to `True` should be `cond is True` or `if cond:`
157-
"E713", # Test for membership should be `not in`
158-
"E714", # Test for object identity should be `is not`
159-
# "E721", # Do not compare types, use `isinstance()`
160-
"E722", # Do not use bare `except`
161-
"E731", # Do not assign a `lambda` expression, use a `def`
162-
# "E741", # Ambiguous variable name: `{name}`
163-
"E742", # Ambiguous class name: `{name}`
164-
"E743", # Ambiguous function name: `{name}`
165-
"E902", # {message}
166-
"E999", # SyntaxError: {message}
117+
"E",
167118
# flake8-errmsg ('EM')
168119
"EM101", # Exception must not use a string literal, assign to variable first
169120
"EM102", # Exception must not use an f-string literal, assign to variable first

sphinx/ext/autodoc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ def format_args(self, **kwargs: Any) -> str:
21692169
kwargs.setdefault('unqualified_typehints', True)
21702170

21712171
try:
2172-
if self.object == object.__init__ and self.parent != object:
2172+
if self.object == object.__init__ and self.parent != object: # NoQA: E721
21732173
# Classes not having own __init__() method are shown as no arguments.
21742174
#
21752175
# Note: The signature of object.__init__() is (self, /, *args, **kwargs).

sphinx/writers/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ def visit_raw(self, node: Element) -> None:
12891289
if 'text' in node.get('format', '').split():
12901290
self.new_state(0)
12911291
self.add_text(node.astext())
1292-
self.end_state(wrap = False)
1292+
self.end_state(wrap=False)
12931293
raise nodes.SkipNode
12941294

12951295
def visit_math(self, node: Element) -> None:

tests/test_events.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
def test_event_priority():
1010
result = []
1111
events = EventManager(object()) # pass an dummy object as an app
12-
events.connect('builder-inited', lambda app: result.append(1), priority = 500)
13-
events.connect('builder-inited', lambda app: result.append(2), priority = 500)
14-
events.connect('builder-inited', lambda app: result.append(3), priority = 200) # earlier
15-
events.connect('builder-inited', lambda app: result.append(4), priority = 700) # later
16-
events.connect('builder-inited', lambda app: result.append(5), priority = 500)
12+
events.connect('builder-inited', lambda app: result.append(1), priority=500)
13+
events.connect('builder-inited', lambda app: result.append(2), priority=500)
14+
events.connect('builder-inited', lambda app: result.append(3), priority=200) # earlier
15+
events.connect('builder-inited', lambda app: result.append(4), priority=700) # later
16+
events.connect('builder-inited', lambda app: result.append(5), priority=500)
1717

1818
events.emit('builder-inited')
1919
assert result == [3, 1, 2, 5, 4]

tests/test_ext_autodoc.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,29 @@ def do_autodoc(app, objtype, name, options=None):
4242

4343
def make_directive_bridge(env):
4444
options = Options(
45-
inherited_members = False,
46-
undoc_members = False,
47-
private_members = False,
48-
special_members = False,
49-
imported_members = False,
50-
show_inheritance = False,
51-
no_index = False,
52-
annotation = None,
53-
synopsis = '',
54-
platform = '',
55-
deprecated = False,
56-
members = [],
57-
member_order = 'alphabetical',
58-
exclude_members = set(),
59-
ignore_module_all = False,
45+
inherited_members=False,
46+
undoc_members=False,
47+
private_members=False,
48+
special_members=False,
49+
imported_members=False,
50+
show_inheritance=False,
51+
no_index=False,
52+
annotation=None,
53+
synopsis='',
54+
platform='',
55+
deprecated=False,
56+
members=[],
57+
member_order='alphabetical',
58+
exclude_members=set(),
59+
ignore_module_all=False,
6060
)
6161

6262
directive = SimpleNamespace(
63-
env = env,
64-
genopt = options,
65-
result = ViewList(),
66-
record_dependencies = set(),
67-
state = Mock(),
63+
env=env,
64+
genopt=options,
65+
result=ViewList(),
66+
record_dependencies=set(),
67+
state=Mock(),
6868
)
6969
directive.state.document.settings.tab_width = 8
7070

tests/test_ext_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def has_binary(binary):
2525
@pytest.mark.skipif(not has_binary('dvipng'),
2626
reason='Requires dvipng" binary')
2727
@pytest.mark.sphinx('html', testroot='ext-math-simple',
28-
confoverrides = {'extensions': ['sphinx.ext.imgmath']})
28+
confoverrides={'extensions': ['sphinx.ext.imgmath']})
2929
def test_imgmath_png(app, status, warning):
3030
app.builder.build_all()
3131
if "LaTeX command 'latex' cannot be run" in warning.getvalue():

0 commit comments

Comments
 (0)