Do extra code style checks with flake8-bugbear

Flake8 Bugbear checks for some extra things that aren’t code style
errors, but are likely to introduce bugs or unexpected behaviour. A
good example is having mutable default function arguments, which get
shared between every call to the function and therefore mutating a value
in one place can unexpectedly cause it to change in another.

This commit enables all the extra warnings provided by Flake8 Bugbear,
except for the line length one (because we already lint for that
separately).

It disables:
- _B003: Assigning to os.environ_ because I don’t really understand this
- _B306: BaseException.message is removed in Python 3_ because I think
  our exceptions have a custom structure that means the `.message`
  attribute is still present
This commit is contained in:
Chris Hill-Scott
2019-11-01 10:43:01 +00:00
parent 9e781177fd
commit fcc84ac514
10 changed files with 37 additions and 31 deletions

View File

@@ -12,4 +12,5 @@ include_trailing_comma=True
[flake8]
# W504 line break after binary operator
extend_ignore=W504
extend_ignore=B003, B306, W504
select=B901, B902, B903