flake8-bugbear
flake8-bugbear copied to clipboard
A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
A very common pattern: ```py candidates = [some for some in another_stuff()] if me in candidates: do_stuff() ``` If `candidates` is only used for an `in`, then we have 2...
Originally reported here: https://github.com/wemake-services/wemake-python-styleguide/issues/1599#issuecomment-703526278 There is a problem with the case of `ast.Tuple` containing anything other than class name or `ast.Attribute`: source code that uses such constructs in *except* handler...
Hi, and thank you for such a great plugin for `flake8`. With release 20.1.1 B014 rule was introduced and flake8 fails with traceback on one case I found. Example code:...
Technically, using re.match is valid. Realistically, the author probably meant .search and is going to lose a ton of time trying to figure out why her regex isn't working. I'm...
> B011 Do not call assert False since python -O removes these calls. Instead callers should raise AssertionError(). There are two problems with this: 1. Removal of assertions with `-O`...
I would be great to have a rule that will detect cases such this: ``` instance = MyClass(arg1, arg2), ``` As it is most likely a typo. If someone wants...
I think B902 is great for detecting errors like this: ``` @classmethod def foo(self): ... ``` However, I also find myself `# noqa:`ing it a bit too frequently. Here are...
[Pydantic validator](https://pydantic-docs.helpmanual.io/#validators) decorators make classmethods from the decorated methods but these are flagged as instance methods The following gets flagged: ``` class UserModel(BaseModel): name: str @validator('name') def name_must_contain_space(cls, v): if...
Haven't debugged. But it raises `hypothesis.errors.FailedHealthCheck` ``` $ coverage run tests/test_bugbear.py .....................You can add @seed(6108964495495638932952417326211249481) to this test to reproduce this failure. E. ====================================================================== ERROR: test_does_not_crash_on_any_valid_code (__main__.TestFuzz) ---------------------------------------------------------------------- Traceback (most...
Context: I just upgraded the flake8 version we use in a repo, and noticed new hits for rule E741. This checks for [PEP8 names to avoid](https://www.python.org/dev/peps/pep-0008/#names-to-avoid). Obviously I just changed...