diff --git a/bugbear.py b/bugbear.py index ee2afd4..88fbd2b 100644 --- a/bugbear.py +++ b/bugbear.py @@ -1046,7 +1046,7 @@ def is_classmethod(decorators: Set[str]) -> bool: return bases = {b.id for b in cls.bases if isinstance(b, ast.Name)} - if "type" in bases: + if any(basetype in bases for basetype in ("type", "ABCMeta", "EnumMeta")): if is_classmethod(decorators): expected_first_args = B902.metacls kind = "metaclass class" diff --git a/tests/b024.py b/tests/b024.py index 238dcd3..f975887 100644 --- a/tests/b024.py +++ b/tests/b024.py @@ -92,7 +92,7 @@ def method(self): class non_keyword_abcmeta_1(ABCMeta): # safe - def method(self): + def method(cls): foo()