diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ace1fe2384e8a02969849fd2b8bc84ff1ba1efab..2cb96446f4eb357a45e8916b4e38671b2901983a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -43,6 +43,6 @@ repos:
   - id: isort
 
 - repo: https://github.com/python/black
-  rev: 19.10b0
+  rev: 22.3.0
   hooks:
   - id: black
diff --git a/setup.cfg b/setup.cfg
index 8d79b7e6db2423e77ef84c8bf91875a47662c2e3..2c446b475ceea8a1105c2d161d12b40caa2a20b9 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,8 @@
 [flake8]
 # E203: whitespaces before ':' <https://github.com/psf/black/issues/315>
 # E231: missing whitespace after ','
+# E501: line too long, use B950 warning from flake8-bugbear instead
 # W503: line break before binary operator <https://github.com/psf/black/issues/52>
-ignore = E203,E231,W503
+select = C,E,F,W,B950
+ignore = E203,E231,E501,W503
 max-line-length = 88
diff --git a/tox.ini b/tox.ini
index 5913c011f4d230bc77550305f93a2eafe8d1afe6..60398bea05ae327fd1ce6a727d2b1dd3b7168e6a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -15,14 +15,15 @@ commands =
 [testenv:black]
 skip_install = true
 deps =
-  black==19.10b0
+  black==22.3.0
 commands =
   {envpython} -m black --check swh
 
 [testenv:flake8]
 skip_install = true
 deps =
-  flake8
+  flake8==4.0.1
+  flake8-bugbear==22.3.23
 commands =
   {envpython} -m flake8