Upgrading flake8-bugbear 23 to 24
Review needed23.12.2 → 24.12.12New9Changed12Fixed5Other2
Review neededUpgrade verdict
12 behavior changes.
In plain terms
- Two existing checks now also look at the newer except* error-handling syntax.
- The B024 check stops flagging classes as abstract when they only have assigned class variables.
- The package now requires at least version 22.2.0 of attrs.
- Adds comments to B008 and renames b008_extend_immutable_calls.
Must act Nothing to change
No breaking, platform, security or deprecated items in this range.
Nothing in this upgrade needs a code or configuration change.
API changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- removed:
class FuntionDefDefaultsVisitor(ast.NodeVisitor) - removed:
constructor FuntionDefDefaultsVisitor(b008_extend_immutable_calls=…) - removed:
field BugBearVisitor.b008_extend_immutable_calls - removed:
field BugBearVisitor.futures - removed:
method FuntionDefDefaultsVisitor.visit(node) - removed:
method FuntionDefDefaultsVisitor.visit_Call(node) - removed:
method FuntionDefDefaultsVisitor.visit_Lambda(node) - removed:
method FuntionDefDefaultsVisitor.visit_mutable_literal_or_comprehension(node) - changed:
field BugBearVisitor.b902_classmethod_decorators → field BugBearVisitor.b902_classmethod_decorators: set[str] - changed:
field BugBearVisitor.contexts → field BugBearVisitor.contexts: list[Context] - changed:
field BugBearVisitor.errors → field BugBearVisitor.errors: list[error] - changed:
field BugBearVisitor.node_window → field BugBearVisitor.node_window: list[ast.AST] - changed:
method B020NameFinder.visit_DictComp(node) → method B020NameFinder.visit_DictComp(node) -> None - changed:
method B020NameFinder.visit_GeneratorExp(node) → method B020NameFinder.visit_GeneratorExp(node) -> None - changed:
method B020NameFinder.visit_Lambda(node) → method B020NameFinder.visit_Lambda(node) -> None - changed:
method B020NameFinder.visit_ListComp(node) → method B020NameFinder.visit_ListComp(node) -> None - changed:
method B020NameFinder.visit_comprehension(node) → method B020NameFinder.visit_comprehension(node) -> None - changed:
method BugBearChecker.load_file() → method BugBearChecker.load_file() -> None - changed:
method BugBearChecker.should_warn(code) → method BugBearChecker.should_warn(code) -> bool - changed:
method BugBearVisitor.check_for_b005(node) → method BugBearVisitor.check_for_b005(node) -> None - changed:
method BugBearVisitor.check_for_b006_and_b008(node) → method BugBearVisitor.check_for_b006_and_b008(node) -> None - changed:
method BugBearVisitor.check_for_b007(node) → method BugBearVisitor.check_for_b007(node) -> None - changed:
method BugBearVisitor.check_for_b011(node) → method BugBearVisitor.check_for_b011(node) -> None - changed:
method BugBearVisitor.check_for_b012(node) → method BugBearVisitor.check_for_b012(node) -> None - changed:
method BugBearVisitor.check_for_b015(node) → method BugBearVisitor.check_for_b015(node) -> None - changed:
method BugBearVisitor.check_for_b016(node) → method BugBearVisitor.check_for_b016(node) -> None - changed:
method BugBearVisitor.check_for_b017(node) → method BugBearVisitor.check_for_b017(node) -> None - changed:
method BugBearVisitor.check_for_b018(node) → method BugBearVisitor.check_for_b018(node) -> None - changed:
method BugBearVisitor.check_for_b019(node) → method BugBearVisitor.check_for_b019(node) -> None - changed:
method BugBearVisitor.check_for_b020(node) → method BugBearVisitor.check_for_b020(node) -> None - changed:
method BugBearVisitor.check_for_b021(node) → method BugBearVisitor.check_for_b021(node) -> None - changed:
method BugBearVisitor.check_for_b022(node) → method BugBearVisitor.check_for_b022(node) -> None - changed:
method BugBearVisitor.check_for_b023(loop_node) → method BugBearVisitor.check_for_b023(loop_node) -> None - changed:
method BugBearVisitor.check_for_b024_and_b027(node: ast.ClassDef) → method BugBearVisitor.check_for_b024_and_b027(node: ast.ClassDef) -> None - changed:
method BugBearVisitor.check_for_b025(node) → method BugBearVisitor.check_for_b025(node) -> None - changed:
method BugBearVisitor.check_for_b026(call: ast.Call) → method BugBearVisitor.check_for_b026(call: ast.Call) -> None - changed:
method BugBearVisitor.check_for_b028(node) → method BugBearVisitor.check_for_b028(node) -> None - changed:
method BugBearVisitor.check_for_b031(loop_node) → method BugBearVisitor.check_for_b031(loop_node) -> None - changed:
method BugBearVisitor.check_for_b032(node) → method BugBearVisitor.check_for_b032(node) -> None - changed:
method BugBearVisitor.check_for_b033(node) → method BugBearVisitor.check_for_b033(node) -> None - changed:
method BugBearVisitor.check_for_b034(node: ast.Call) → method BugBearVisitor.check_for_b034(node: ast.Call) -> None - changed:
method BugBearVisitor.check_for_b035(node: ast.DictComp) → method BugBearVisitor.check_for_b035(node: ast.DictComp) -> None - changed:
method BugBearVisitor.check_for_b901(node) → method BugBearVisitor.check_for_b901(node: ast.FunctionDef) -> None - changed:
method BugBearVisitor.check_for_b903(node) → method BugBearVisitor.check_for_b903(node) -> None - changed:
method BugBearVisitor.check_for_b904(node) → method BugBearVisitor.check_for_b904(node) -> None - changed:
method BugBearVisitor.check_for_b905(node) → method BugBearVisitor.check_for_b905(node) -> None - changed:
method BugBearVisitor.check_for_b906(node: ast.FunctionDef) → method BugBearVisitor.check_for_b906(node: ast.FunctionDef) -> None - changed:
method BugBearVisitor.check_for_b907(node: ast.JoinedStr) → method BugBearVisitor.check_for_b907(node: ast.JoinedStr) -> None - changed:
method BugBearVisitor.check_for_b908(node: ast.With) → method BugBearVisitor.check_for_b908(node: ast.With) -> None - changed:
method BugBearVisitor.visit(node) → method BugBearVisitor.visit(node) -> None - changed:
method BugBearVisitor.visit_AnnAssign(node) → method BugBearVisitor.visit_AnnAssign(node) -> None - changed:
method BugBearVisitor.visit_Assert(node) → method BugBearVisitor.visit_Assert(node) -> None - changed:
method BugBearVisitor.visit_Assign(node) → method BugBearVisitor.visit_Assign(node: ast.Assign) -> None - changed:
method BugBearVisitor.visit_AsyncFor(node) → method BugBearVisitor.visit_AsyncFor(node) -> None - changed:
method BugBearVisitor.visit_AsyncFunctionDef(node) → method BugBearVisitor.visit_AsyncFunctionDef(node) -> None - changed:
method BugBearVisitor.visit_Call(node) → method BugBearVisitor.visit_Call(node) -> None - changed:
method BugBearVisitor.visit_ClassDef(node) → method BugBearVisitor.visit_ClassDef(node: ast.ClassDef) -> None - changed:
method BugBearVisitor.visit_Compare(node) → method BugBearVisitor.visit_Compare(node) -> None - changed:
method BugBearVisitor.visit_DictComp(node) → method BugBearVisitor.visit_DictComp(node) -> None - changed:
method BugBearVisitor.visit_ExceptHandler(node) → method BugBearVisitor.visit_ExceptHandler(node: ast.ExceptHandler) -> None - changed:
method BugBearVisitor.visit_For(node) → method BugBearVisitor.visit_For(node) -> None - changed:
method BugBearVisitor.visit_FunctionDef(node) → method BugBearVisitor.visit_FunctionDef(node) -> None - changed:
method BugBearVisitor.visit_GeneratorExp(node) → method BugBearVisitor.visit_GeneratorExp(node) -> None - changed:
method BugBearVisitor.visit_Import(node) → method BugBearVisitor.visit_Import(node) -> None - changed:
method BugBearVisitor.visit_ImportFrom(node) → method BugBearVisitor.visit_ImportFrom(node) -> None - changed:
method BugBearVisitor.visit_JoinedStr(node) → method BugBearVisitor.visit_JoinedStr(node) -> None - changed:
method BugBearVisitor.visit_ListComp(node) → method BugBearVisitor.visit_ListComp(node) -> None - changed:
method BugBearVisitor.visit_Module(node) → method BugBearVisitor.visit_Module(node) -> None - changed:
method BugBearVisitor.visit_Raise(node) → method BugBearVisitor.visit_Raise(node: ast.Raise) -> None - changed:
method BugBearVisitor.visit_Set(node) → method BugBearVisitor.visit_Set(node) -> None - changed:
method BugBearVisitor.visit_SetComp(node) → method BugBearVisitor.visit_SetComp(node) -> None - changed:
method BugBearVisitor.visit_Try(node) → method BugBearVisitor.visit_Try(node) -> None - changed:
method BugBearVisitor.visit_UAdd(node) → method BugBearVisitor.visit_UAdd(node) -> None - changed:
method BugBearVisitor.visit_While(node) → method BugBearVisitor.visit_While(node) -> None - changed:
method BugBearVisitor.visit_With(node) → method BugBearVisitor.visit_With(node) -> None - changed:
method NameFinder.visit_Name(node: ast.Name) → method NameFinder.visit_Name(node: ast.Name) -> None - changed:
method NamedExprFinder.visit_NamedExpr(node: ast.NamedExpr) → method NamedExprFinder.visit_NamedExpr(node: ast.NamedExpr) -> None - changed:
static method BugBearChecker.add_options(optmanager) → static method BugBearChecker.add_options(optmanager) -> None - added:
class B040CaughtException - added:
class B041UnhandledKeyType - added:
class B041VariableKeyType - added:
class B909Checker(ast.NodeVisitor) - added:
class ExceptBaseExceptionVisitor(ast.NodeVisitor) - added:
class FunctionDefDefaultsVisitor(ast.NodeVisitor) - added:
constructor B909Checker(name: str, key: str) -> None - added:
constructor ExceptBaseExceptionVisitor(except_node: ast.ExceptHandler) -> None - added:
constructor FunctionDefDefaultsVisitor(error_code_calls, error_code_literals, b008_b039_extend_immutable_calls=…) -> None - added:
field B040CaughtException.has_note: bool - added:
field B040CaughtException.name: str - added:
field B041VariableKeyType.name: str - added:
field B909Checker.MUTATING_FUNCTIONS - added:
field BugBearVisitor.b008_b039_extend_immutable_calls: set[str] - added:
field BugBearVisitor.b040_caught_exception: B040CaughtException | None - added:
field BugBearVisitor.in_trystar: str - added:
function is_name(node: ast.expr, name: str) -> bool - added:
method B909Checker.visit(node) - added:
method B909Checker.visit_Assign(node: ast.Assign) -> None - added:
method B909Checker.visit_AugAssign(node: ast.AugAssign) -> None - added:
method B909Checker.visit_Call(node: ast.Call) -> None - added:
method B909Checker.visit_Delete(node: ast.Delete) -> None - added:
method B909Checker.visit_If(node: ast.If) -> None - added:
method BugBearVisitor.check_for_b013_b014_b029_b030(node: ast.ExceptHandler) -> list[str] - added:
method BugBearVisitor.check_for_b039(node: ast.Call) -> None - added:
method BugBearVisitor.check_for_b040_add_note(node: ast.Attribute) -> bool - added:
method BugBearVisitor.check_for_b040_usage(node: ast.expr | None) -> None - added:
method BugBearVisitor.check_for_b041(node) -> None - added:
method BugBearVisitor.check_for_b909(node: ast.For) -> None - added:
method BugBearVisitor.check_for_b910(node: ast.Call) -> None - added:
method BugBearVisitor.check_for_b911(node: ast.Call) -> None - added:
method BugBearVisitor.in_class_init() -> bool - added:
method BugBearVisitor.visit_Dict(node) -> None - added:
method BugBearVisitor.visit_Return(node: ast.Return) -> None - added:
method BugBearVisitor.visit_TryStar(node) -> None - added:
method BugBearVisitor.visit_Yield(node: ast.Yield) -> None - added:
method BugBearVisitor.visit_YieldFrom(node: ast.YieldFrom) -> None - added:
method ExceptBaseExceptionVisitor.re_raised() -> bool - added:
method ExceptBaseExceptionVisitor.visit_ExceptHandler(node: ast.ExceptHandler) - added:
method ExceptBaseExceptionVisitor.visit_Raise(node: ast.Raise) - added:
method FunctionDefDefaultsVisitor.visit(node) -> None - added:
method FunctionDefDefaultsVisitor.visit_Call(node) -> None - added:
method FunctionDefDefaultsVisitor.visit_Lambda(node) -> None - added:
method FunctionDefDefaultsVisitor.visit_mutable_literal_or_comprehension(node) -> None - added:
variable B005_METHODS - added:
variable B006_MUTABLE_CALLS - added:
variable B006_MUTABLE_COMPREHENSIONS - added:
variable B006_MUTABLE_LITERALS - added:
variable B008_IMMUTABLE_CALLS - added:
variable B014_REDUNDANT_EXCEPTIONS - added:
variable B019_CACHES - added:
variable B036 - added:
variable B037 - added:
variable B039 - added:
variable B040 - added:
variable B041 - added:
variable B902_CLS - added:
variable B902_IMPLICIT_CLASSMETHODS - added:
variable B902_METACLS - added:
variable B902_SELF - added:
variable B909 - added:
variable B910 - added:
variable B911