NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #2500 most downloaded on PyPI
A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
Latest stable
26.11.9
Last release 13 days ago
09 Nov 2026
Release timing varies
gaps range from 2 weeks to 10 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
5 versions withdrawn
withdrawn after publishing
11 years old
78 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Drop Python 3.10 support (flake8 itself now requires >=3.11)
map(), filter(), reversed(), zip() or
enumerate() statement when the name is the builtin, not when the module
defines or imports its own function under that name, which may well do the workgroupby/batched imported from itertools no longer
counts as itertools when a later module-level def or assignment replaces itbatched: Callable = itertools.batched counts as
itertools, like the same assignment without the annotationmap() and zip() when the name is the builtin, not
when a module-level def, class, import or assignment replaces it with
something elsezip() and defaultdict(int) when the name is the
builtin zip/collections.defaultdict, not when a module-level def,
class, import or assignment replaces it with something elsezip = builtins.zip style alias
inside a function or class no longer overrides the module's own def,
class or import of that name, since it only binds the name locally__init__ that calls a direct base class's __init__
explicitly and forwards its own arguments unchanged and in order, like
Exception.__init__(self, msg, opt), also after another base's __init__
such as a mixin'smypy --strict in tox and CIYour coding agent can read these notes before it upgrades. Set up the MCP server →
B007: don't flag a loop variable that is read by a function or lambda defined in the same scope as the loop
* B007: don't flag a loop variable that is read by a function or lambda defined
in the same scope as the loop (#175)
* B049: New check for ``@abstractmethod`` listed before ``@property``,
``@classmethod`` or ``@staticmethod`` (or a property ``.setter``/``.getter``/
``.deleter``). It must be the innermost decorator, otherwise the class definition
raises ``AttributeError`` (#279)
* B906: don't flag ``visit_`` methods of libcst visitors (classes inheriting
from ``libcst``), which have no ``generic_visit`` (#359)
* B045: detect reuse of an enclosing loop's control variable in a nested loop
in the same scope (#360).
* B046: New check for ``dict.fromkeys()`` called with a mutable value, which is
shared by every key (#387)
* B005: say in the message that only strings with repeated characters are
reported, since ``.strip("abc")`` style character sets are fine (#91)
* B047: New check for ``except`` handlers that can never run because an earlier
handler already catches a builtin parent exception (#349)
* B044: also report asserts on other always-true values, such as a message
without a condition (``assert "x must be positive"``), non-zero numbers,
f-strings with literal text, non-empty list/set/dict literals and lambdas
(#534, #440)
* B031: only treat a bare ``groupby()`` call as ``itertools.groupby`` when the
module doesn't bind ``groupby`` to something else, such as its own
``def groupby`` (#356)
* B025: fix the message running ``except`` and the exception name together
(``exceptValueError``) and dropping the ``*`` for ``except*`` handlers
* B903: don't flag classes that inherit from another class, like an exception
or ``dict`` subclass, which a namedtuple can't replace, and fix ``__slot__``
in the message to ``__slots__`` (#63)
* B950: respect the ``max-doc-length`` option for docstring and comment-only lines,
as ``pycodestyle``'s ``W505`` does; behavior is unchanged when it is not set (#285)
* B902: treat ``abc.abstractclassmethod`` and ``abc.abstractstaticmethod`` like
``classmethod`` and ``staticmethod`` instead of expecting ``self`` (#33)
* B909: also check loops over ``d.keys()``, ``d.values()`` and ``d.items()``,
which are views of ``d``, so ``for k in d.keys(): d.pop(k)`` is reported like
``for k in d: d.pop(k)``
* B012: don't flag ``break`` or ``continue`` in an ``async for`` loop inside a
``finally`` block, as for ``for`` and ``while`` loops
* B018: also report generator expressions and lambdas used as statements. A
statement like ``(print(x) for x in items)`` never runs its body, and a bare
``lambda x: True`` is usually an assignment that lost its target (#452)
* B018: also report ``map()``, ``filter()``, ``reversed()``, ``zip()`` and
``enumerate()`` calls used as statements. They return lazy iterators, so
``map(print, items)`` on its own line never calls ``print`` (#452)
* B909: also check mutations in ``if`` conditions and ``elif``/``else``
branches inside loops (#606)
* B042: don't treat a class named like an exception as one when its only base is
``object``, as in ``class ParsedException(object)`` (#538)
* B911: only treat a bare ``batched()`` call as ``itertools.batched`` when the
module doesn't bind ``batched`` to something else, such as its own
``def batched``, the same way B031 handles ``groupby()``
B008: resolve direct module-level imports and aliases when matching extend-immutable-calls
extend-immutable-calls (#252)series in for i, (ax, (series, name)) in enumerate(zip(axs, series)); the loop rebinds the top-level targets, not those names (#521){**d for d in ...} dict unpacking in comprehensions, new in Python 3.15; B035 no longer mistakes the unpacked expression for a static key+c * d continuation line that lost its parentheses (#452)ContextManager[T]; a generic base named like an exception, such as MyError[int], now counts (#538)B044: New check for assert , which is always true
assert <generator_expression>, which is always true (#534)list(group) or tuple(group) back to the same name (#395)warnings.warn calls that pass an explicitly empty skip_file_prefixes tuple (#510)async_lru.alru_cache and check cache decorators on async def methods (#488)for self.a in self.b: rebinding an attribute is not rebinding the base name (#248)isinstance(x, int) without assigning or using the resultgroupby generator, and don't treat references in mutually exclusive if/elif/else branches as multiple uses (#465)abc.ABCMeta or enum.EnumMeta (#411)_ targets in zip() loops (#545)map() supports strict= (#548)B044: New check for assert <generator_expression>, which is always true (#534)
B031: allow reusing a group after assigning list(group) or tuple(group) back to the same name (#395)
B028: report warnings.warn calls that pass an explicitly empty skip_file_prefixes tuple (#510)
B019: also flag async_lru.alru_cache and check cache decorators on async def methods (#488)
B023: don't flag a function whose every reference is a direct call inside the loop body: such a function cannot outlive the iteration it was defined in (#468, #380)
B020: don't flag for self.a in self.b: rebinding an attribute is not rebinding the base name, so two different attributes of the same object are two bindings (#248)
B018: handle also useless calls such as isinstance(x, int) without assigning or using the result
B031: don't count a store-context reference (e.g. an annotation target like group: T) as a use of the groupby generator, and don't treat references in mutually exclusive if / elif / else branches as multiple uses while preserving warnings when the conditional can run repeatedly (#465)
B902: don't raise a false positive on a metaclass defined with a dotted base such as abc.ABCMeta or enum.EnumMeta (#411)
B913: Add an optional check for unused _ targets in zip() loops (#545)
B912: only emit on Python 3.14+ where map() supports strict= (#548)
Recursion errors raised during rules evaluation show a message instead of a raw traceback (#560)
B043: Add new check to state don't call delattr with constant
B042: New check for reminding to call super().__init__ in custom exceptions
map() without an explicit strict= parameter. (#516)B012 and B025 now also handle try/except*
*args or **kwargs (#501)B041: New dictionary same key AND value check
B910: implement to suggest using Counter() instead of defaultdict(int)
ContextVar with mutable literal or function call as defaultB909: Fix false positive affecting containers of mutables
B950: Add pragma comment to line length ignores
B902: Remove decorators named validator and root_validator from B902 checks
B038: Restrict rule to mutation functions only
B036: Fix crash on raise statements raising something other than
raise statements raising something other thanB038: Add check for mutations of loop iterator
B018: to detect useless-statements at all levels
B035: Fix false positive when named expressions are used
B035: add check for static keys in dict-comprehension
fix name collision for node_stack on python 3.12
Add B034: re.sub/subn/split must pass flags/count/maxsplit as keyword arguments.
Include tox.ini in MANIFEST.in for sdist.
Add B033: Detect duplicate items in sets
flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0
except a[0].b:)B030: Fix crash on certain unusual except handlers (e.g. except a[0].b: )
Add B033: Check for duplicate items in sets.
B950: now ignores 'noqa' and 'type: ignore' comments.
strip() method on an imported module.The ast.Bytes, ast.Num and ast.Str nodes are all deprecated, but may still be used by some codebases in order to maintain backwards compatibility with…
visit_Bytes, visit_Num and visit_Str to the list of visit_*
functions that are ignored by the B906 check. The ast.Bytes, ast.Num and
ast.Str nodes are all deprecated, but may still be used by some codebases in
order to maintain backwards compatibility with Python 3.7.except with an empty tuple i.e. except: ().B906: Add visit_Bytes , visit_Num and visit_Str to the list of visit_* functions that are ignored by the B906 check. The ast.Bytes , ast.Num and ast.Str nodes are all deprecated, but may still be used by some codebases in order to maintain backwards compatibility with Python 3.7.
B016: Warn when raising f-strings.
Add B028: Check for an explicit stacklevel keyword argument on the warn method from the warnings module.
Add B029: Check when trying to use except with an empty tuple i.e. except (): .
Add B030: Check that except handlers only use exception classes or tuples of exception classes. Fixes crash on some rare except handlers.
Add B031: Check that itertools.groupby() is not used multiple times.
Add B032: Check for possible unintentional type annotations instead of assignments.
B024: now ignores classes without any methods.
pytest.raises() has a match argument. (#334)visit_ functions with a _fields attribute that can't contain ast.AST subnodes. (#330)Rename B028 to B907, making it optional/opinionated.
Add B906: visit_ function with no further calls to a visit function.
visit_ function with no further calls to a visit function. (#313)!r when formatted value in f-string is surrounded by quotes. (#319)Add B905: zip() without an explicit strict= parameter.
zip() without an explicit strict= parameter. (#314)B027: Ignore @overload decorator
Make B015 and B018 messages slightly more polite
tox (#294)pyproject.toml package (#291)add B026: find argument unpacking after keyword argument
Add B025: Find duplicate except clauses
Add B024 error code to message for B024
Add B024: abstract base class with no abstract methods
Implement late-binding loop check
Don't crash when select / extend_select are None
Ignore black formatting for b013 test case
Ignore black formatting for b013 test case (#251)
B010 Fix lambda flase positive (#246)
B008 Fix edge case with lambda functions (#243)
B006 and B008: Detect function calls at any level of the default expression
B022: No arguments passed to contextlib.suppress
Build universal Python 3 wheels
B018: Disable strings from check for now
B904: ensure the raise is in the same context with the except
binascii.Error is now treated as a subclass of ValueError (#206)Fix crash on call in except statement in _to_name_str
Update B008: Whitelist more immutable function calls
raise without from in an except clause (#181)Verify the element in item_context.args is of type ast.Name for b017
Verify the element in item_context.args is of type ast.Name for b017
Add another hasattr() check to b017 visit for .func
Happy April Fools! This is no joke, it's a real release.
Happy April Fools! This is no joke, it's a real release.
Catching them all is bad!
Fix crash on tuple expansion in try/except block
Make sure float infinity/NaN does not trigger B008
Support exception aliases properly in B014
- Ignore keywords for B009/B010
Silence B009/B010 for non-identifiers
Refer to README.rst for changes.
Refer to README.rst for changes.
Refer to README.rst for changes.
Refer to README.rst for changes.
Allow continue/break within loops in finally clauses for B012
For B001, also check for except ():
Introduce B013 and B014 to check tuples in except (..., ): statements
Refer to README.md for changes.
Refer to README.md for changes.
Warn about continue/return/break in finally block (#100)
Removed a colon from the descriptive message in B008. (#96)
Refer to README.md for changes.
Refer to README.md for changes.
Fix .travis.yml syntax + add Python 3.8 + nightly tests
Fix black formatting + enforce via CI
Make B901 not apply to await methods
Refer to README.md for changes.
Refer to README.md for changes.
allow 'mcs' for metaclass classmethod first arg (PyCharm default)
Introduce B011
Introduce B009 and B010
Exclude immutable calls like tuple() and frozenset() from B008
For B902, the first argument for metaclass class methods can be "mcs", matching the name preferred by PyCharm.
Examine kw-only args for mutable defaults
black format all .py files
Examine kw-only args for mutable defaults
Test for Python 3.7
- packaging fixes
One column per quarter.