mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-31 11:16:54 +00:00
linters: Add flake8-bugbear for finding bugs and design problems
Also, make appropriate changes to satisfy issues flagged by `flake8-bugbear`.
This commit is contained in:
parent
e2c4b50a46
commit
b42e758ac7
3 changed files with 7 additions and 3 deletions
|
|
@ -503,7 +503,7 @@ class FileChecker(object):
|
|||
runner = checker.run()
|
||||
except AttributeError:
|
||||
runner = checker
|
||||
for (line_number, offset, text, check) in runner:
|
||||
for (line_number, offset, text, _) in runner:
|
||||
self.report(
|
||||
error_code=None,
|
||||
line_number=line_number,
|
||||
|
|
@ -668,11 +668,14 @@ def _run_checks(checker):
|
|||
|
||||
|
||||
def find_offset(offset, mapping):
|
||||
# type: (int, processor._LogicalMapping) -> Tuple[int, int]
|
||||
"""Find the offset tuple for a single offset."""
|
||||
if isinstance(offset, tuple):
|
||||
return offset
|
||||
|
||||
for token_offset, position in mapping:
|
||||
for token in mapping:
|
||||
token_offset = token[0]
|
||||
if offset <= token_offset:
|
||||
position = token[1]
|
||||
break
|
||||
return (position[0], position[1] + offset - token_offset)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue