Skip to content

Draft: Projects: enable flake8-bugbear warnings

Frank Winklmeier requested to merge fwinkl/athena:bugbear into main

Enable the additional flake8-bugbear warnings. See https://github.com/PyCQA/flake8-bugbear for the list of warnings and the list of athena MRs for typical fixes that were required (of which there were some real bugs).

The following are (for the moment) being ignored:

  • B006: Do not use mutable data structures for argument defaults, e.g. def foo(input=[])
    • In principle a good idea but will require a huge number of fixes.
  • B007: Loop control variable not used within the loop body.
    • Harmless warning and code like for name,value in mydict.items() could be considered more readable than for _,value in mydict.items() even if name is unused.
  • B019: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks.
    • Indeed, trade-off between memory and speed but we use it for the latter in many places.

Thanks to @maszyman for pointing out this useful plugin.

Requires: !71255 (merged)

Edited by Frank Winklmeier

Merge request reports