flake8-bugbear icon indicating copy to clipboard operation
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.

Results 86 flake8-bugbear issues
Sort by recently updated
recently updated
newest added

Shouldn't B019 be emitted only when `maxsize` is `None`, as in https://github.com/PyCQA/pylint/pull/6181?

When passing configurations to functions, it is quite annoying to have to do the whole `Optional[Mapping[str, Any]] = None` dance. It would be nice if it was possible to allow...

Hi, currently flake8-bugbear seems to primarily (only?) contain errors/warnings either inherent to python code or constructs from the python stdlib, but there are some popular third party libraries, such as...

help wanted
question

```python def some_fn(*_) -> None: ... for _ in range(1): foo = 0 some_fn(lambda: foo) ``` Since `foo` is a local variable in the loop, `B023` shouldn't happen here (unless...

flake8 causes error: `B023 Function definition does not bind loop variable 'chk_key'` for the following code. ``` ret_df = pd.DataFrame(index=target_df.index) for chk_key in [nalod, nlod]: ret_df[chk_key] = ( False if...

Code to reproduce: ```python from itertools import groupby for _, gen in groupby([]): gen = list(gen) print(gen) ``` This wrongly triggers B031 even though the generator is indeed saved to...

Suggest the following fix when passing a mutable 2nd arg to `dict.fromkeys()` since modifications will affect all keys which is a common pitfall. ```py # bad dict.fromkeys((1, 2), {}) dict.fromkeys((1,...

```python a: int | int | float = ... b: Union[List[int, int]] = ... c: Optional[int] | int | None = ... # can probably rely on other linters to...

enhancement
help wanted

I am suggesting a new check to recommend replacing ``defaultdict(int)`` with ``Counter()``, both of which are from the standard library ``collections``, due to the former having a major gotcha with...

enhancement
help wanted

I think false positives like those reported in #356 (and probably some false negatives as well) are prevalent across multiple lints and one way to solve them would be to...