← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:pre-commit-flake8-bugbear into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:pre-commit-flake8-bugbear into launchpad:master.

Commit message:
pre-commit: Enable flake8-bugbear

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/454762

We haven't yet fixed all its default warnings, but most of them seem reasonable.  Get this into our `pre-commit` checks so that we at least don't regress the ones we've fixed so far.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pre-commit-flake8-bugbear into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 12369b7..7e7f119 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -60,6 +60,7 @@ repos:
         additional_dependencies:
           - flake8-absolute-import==1.0.0.1
           - flake8-alfred==1.1.1
+          - flake8-bugbear==23.3.12
 -   repo: https://github.com/pre-commit/mirrors-eslint
     rev: v8.33.0
     hooks:
diff --git a/setup.cfg b/setup.cfg
index faaf10b..51645e8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -191,6 +191,16 @@ exclude =
     # to Launchpad's style.
     lib/contrib
 ignore =
+    # Temporarily ignore Bugbear checks that we haven't yet fixed everywhere.
+    B004,
+    B006,
+    B008,
+    B011,
+    B015,
+    B020,
+    B023,
+    B028,
+    B031,
     # Incompatible with Black.
     E203,
     # ==/!= comparisons with True/False/None are common idioms with Storm.