mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 10:36:53 +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)
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class AfterInitFormatter(base.BaseFormatter):
|
|||
def test_after_init_is_always_called():
|
||||
"""Verify after_init is called."""
|
||||
formatter = AfterInitFormatter(options())
|
||||
assert getattr(formatter, 'post_initialized') is True
|
||||
assert formatter.post_initialized is True
|
||||
|
||||
|
||||
class FormatFormatter(base.BaseFormatter):
|
||||
|
|
|
|||
1
tox.ini
1
tox.ini
|
|
@ -45,6 +45,7 @@ basepython = python3
|
|||
skip_install = true
|
||||
deps =
|
||||
flake8
|
||||
flake8-bugbear
|
||||
flake8-colors
|
||||
flake8-docstrings>=1.3.1
|
||||
flake8-import-order>=0.9
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue