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.
Hi! In a Windows VM, and in a bad case where pip's resolver backtracks all the way to version 16.4.0, pip will abort dependency resolution entirely. This is because the...
We discovered some potential false positives in pybind11 (see [here](https://github.com/pybind/pybind11/pull/2731/files)) - specifically, a test like this reports: ```python with pytest.raises(TypeError): y < object() ``` Might not be fixable, and this...
When upgrading, some false positives were found for B023 (implimented in https://github.com/PyCQA/flake8-bugbear/pull/265). ## Example ```python """B023.py""" def filter_values(values: list[list[int]], max_percentage: float): for value in values: filter_val = max(value) * max_percentage...
In an empty folder (no .flake8, tox.ini, or setup.cfg present) ``` echo "foo = 'foo'" > bug.py flake8 --extend-ignore=E501 --extend-select=B950 --max-line-length=9 bug.py ``` Gives me no errors. Adding verbose logging...
Ref https://github.com/PyCQA/pyflakes/issues/147 In many cases, unused function arguments are bugs. As such detection behavior would be inappropriate in Pyflakes per the above, the best place to implement such a rule...
So recently I've come across some code that looks like this: ```python grid = [[0] * 3] * 3 ``` Turns out this innocent looking piece of code does not...
If I use `--extend-ignore` or `--extend-select` options, B950 is not taken into account. OK: ``` ▹ flake8 --select=E,B950 longline.py longline.py:1:80: E501 line too long (109 > 79 characters) longline.py:1:110: B950...
with the following: ```python def ham(): pass ["hello", "world"] ``` when running `pipx run --spec="flake8-bugbear" flake8 fluke8.py --include="B018"`, I expected to see: ``` flake8.py:5:1: B018 Found useless expression. Either assign...
B020 Bug
This is similar to #235 but with sort keys. ```python for student in sorted(students, key=lambda student: student.last_name): ... ``` results in B020 but it seems like it should be fine.
minimal reproduction (trigger any `B9*` warning with the default settings) ```console $ rm -rf venv && virtualenv -qq venv && venv/bin/pip install -qq git+https://github.com/pycqa/flake8 git+https://github.com/pycqa/flake8-bugbear && venv/bin/flake8 --config /dev/null -