Skip to content

Commit 51908c1

Browse files
authored
Add flake8-noqa plugin. (#891)
1 parent df87090 commit 51908c1

25 files changed

+126
-127
lines changed

TODO_add_checks

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
pyflakes
77
pydocstyle
88
flake8-comprehensions
9-
flake8-noqa
10-
mccabe
119

1210
- prettier
1311
- mypy

doc/api/pydoc/build.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def classify_class_attrs(cls):
8181
kind = "class method"
8282
elif isinstance(obj, property):
8383
kind = "property"
84-
elif (inspect.ismethod(obj_via_getattr) or # noqa W504
84+
elif (inspect.ismethod(obj_via_getattr) or # noqa: W504
8585
inspect.ismethoddescriptor(obj_via_getattr)):
8686
kind = "method"
8787
else:
@@ -98,7 +98,7 @@ def classify_class_attrs(cls):
9898
class DefaultFormatter(pydoc.HTMLDoc):
9999
"""Default formatter."""
100100

101-
def docmodule(self, object, name=None, mod=None, packageContext = None, *ignored): # noqa C901
101+
def docmodule(self, object, name=None, mod=None, packageContext=None, *ignored): # noqa: C901
102102
"""Produce HTML documentation for a module object."""
103103
my_name = object.__name__ # ignore the passed-in name
104104
parts = split(my_name, '.')
@@ -191,7 +191,7 @@ def docmodule(self, object, name=None, mod=None, packageContext = None, *ignored
191191
if classes:
192192
# FIX classlist = map(lambda (key, value): value, classes)
193193
contents = [
194-
self.formattree(inspect.getclasstree(classlist, 1), my_name)] # noqa F821
194+
self.formattree(inspect.getclasstree(classlist, 1), my_name)] # noqa: F821
195195
for key, value in classes:
196196
contents.append(self.document(value, key, my_name, fdict, cdict))
197197
result = result + self.bigsection(
@@ -264,7 +264,7 @@ def moduleSection(self, object, packageContext):
264264
items.append(
265265
self.modpkglink((modname, name, ispackage, isshadowed))
266266
)
267-
except: # noqa E722 NOSONAR
267+
except: # noqa: E722 NOSONAR
268268
items.append(
269269
self.modpkglink((modname, name, ispackage, isshadowed))
270270
)
@@ -440,8 +440,8 @@ def clean(self, objectList, object):
440440
for excludeObject in self.exclusions.values():
441441
if hasattr(excludeObject, key) and excludeObject is not object:
442442
if (
443-
getattr(excludeObject, key) is value or # noqa W504
444-
(hasattr(excludeObject, '__name__') and # noqa W504
443+
getattr(excludeObject, key) is value or # noqa: W504
444+
(hasattr(excludeObject, '__name__') and # noqa: W504
445445
excludeObject.__name__ == "Numeric"
446446
)
447447
):

doc/api/pydoctor/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424

2525
if os.path.exists('../../../build'):
2626
shutil.move("html", "../../../build/pydoctor")
27-
except: # noqa E722 NOSONAR pylint: disable=bare-except
27+
except: # noqa: E722 NOSONAR pylint: disable=bare-except
2828
print("Pydoctor unavailable...not building")

examples/common/modbus_payload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ def run_binary_payload_ex():
163163
wordorder=word_endian)
164164

165165
assert decoder._byteorder == (builder._byteorder, # nosec pylint: disable=protected-access
166-
"Make sure byteorder is consistent between BinaryPayloadBuilder and BinaryPayloadDecoder") # noqa E501
166+
"Make sure byteorder is consistent between BinaryPayloadBuilder and BinaryPayloadDecoder") # noqa: E501
167167

168168
assert decoder._wordorder == (builder._wordorder, # nosec pylint: disable=protected-access
169-
"Make sure wordorder is consistent between BinaryPayloadBuilder and BinaryPayloadDecoder") # noqa E501
169+
"Make sure wordorder is consistent between BinaryPayloadBuilder and BinaryPayloadDecoder") # noqa: E501
170170

171171
decoded = OrderedDict([
172172
('string', decoder.decode_string(len(my_string))),

examples/common/synchronous_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def run_sync_client():
147147
assert not rr.isError() # nosec test that we are not an error
148148

149149
arguments = {
150-
'read_address': 1, # noqa E221
151-
'read_count': 8, # noqa E221
152-
'write_address': 1, # noqa E221
150+
'read_address': 1,
151+
'read_count': 8,
152+
'write_address': 1,
153153
'write_registers': [20] * 8,
154154
}
155155
log.debug("Read write registers simultaneously")

examples/contrib/asynchronous_asyncio_serial_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ async def start_async_test(client):
7878
assert rq.function_code < 0x80 # nosec test that we are not an error
7979

8080
arguments = {
81-
'read_address': 1, # noqa E221
82-
'read_count': 8, # noqa E221
83-
'write_address': 1, # noqa E221
81+
'read_address': 1,
82+
'read_count': 8,
83+
'write_address': 1,
8484
'write_registers': [20] * 8,
8585
}
8686
rq = await client.readwrite_registers(unit=UNIT, **arguments)

examples/contrib/concurrent_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def create(cls, in_process=False):
6565
# We use named tuples here as they are very lightweight while giving us
6666
# all the benefits of classes.
6767
# -------------------------------------------------------------------------- #
68-
WorkRequest = namedtuple('WorkRequest', 'request, work_id') # noqa 241
68+
WorkRequest = namedtuple('WorkRequest', 'request, work_id')
6969
WorkResponse = namedtuple('WorkResponse', 'is_exception, work_id, response')
7070

7171

examples/contrib/libmodbus_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ def create_rtu_client(cls, **kwargs):
163163
:param baudrate: The baud rate to use for the serial device
164164
:returns: A new level1 client
165165
"""
166-
my_port = kwargs.get('port', '/dev/ttyS0') # noqa E221
166+
my_port = kwargs.get('port', '/dev/ttyS0')
167167
baudrate = kwargs.get('baud', Defaults.Baudrate)
168-
parity = kwargs.get('parity', Defaults.Parity) # noqa E221
168+
parity = kwargs.get('parity', Defaults.Parity)
169169
bytesize = kwargs.get('bytesize', Defaults.Bytesize)
170170
stopbits = kwargs.get('stopbits', Defaults.Stopbits)
171171
my_client = LIB.modbus_new_rtu(my_port, baudrate, parity, bytesize, stopbits)

examples/contrib/message_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,10 @@ def main():
257257
print("Logging is not supported on this system")
258258

259259
framer = {
260-
'tcp': ModbusSocketFramer, # noqa E221
261-
'rtu': ModbusRtuFramer, # noqa E221
260+
'tcp': ModbusSocketFramer,
261+
'rtu': ModbusRtuFramer,
262262
'binary': ModbusBinaryFramer,
263-
'ascii': ModbusAsciiFramer, # noqa E221
263+
'ascii': ModbusAsciiFramer,
264264
}.get(option.framer, ModbusSocketFramer)(None)
265265

266266
generate_messages(framer, option)

examples/contrib/message_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ def main():
195195
print(f"Logging is not supported on this system- {exc}")
196196

197197
framer = {
198-
'tcp': ModbusSocketFramer, # noqa E221
199-
'rtu': ModbusRtuFramer, # noqa E221
198+
'tcp': ModbusSocketFramer,
199+
'rtu': ModbusRtuFramer,
200200
'binary': ModbusBinaryFramer,
201-
'ascii': ModbusAsciiFramer, # noqa E221
201+
'ascii': ModbusAsciiFramer,
202202
}.get(option.framer or option.parser, ModbusSocketFramer)
203203

204204
decoder = Decoder(framer, option.ascii)

0 commit comments

Comments
 (0)