diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index bb8a35f507f77c886d1470deae5d36c3ce23f98f..8be6a05dbf6a395f8456061732ff32685cddde80 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,14 +3,14 @@
 # See https://pre-commit.com/hooks.html for more hooks
 repos:
 -   repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v3.2.0
+    rev: v4.3.0
     hooks:
     -   id: trailing-whitespace
     -   id: end-of-file-fixer
     -   id: check-yaml
     -   id: check-added-large-files
 -   repo: https://github.com/psf/black
-    rev: stable
+    rev: 22.8.0
     hooks:
     - id: black
       language_version: python3.9
@@ -20,3 +20,8 @@ repos:
                       grav_waves/run_population_scripts/run_PPISN_population.py|
                       grav_waves/run_population_scripts/run_PPISN_population_new.py|
                   )$
+-   repo: https://github.com/pycqa/flake8
+    rev: 5.0.4
+    hooks:
+    -   id: flake8
+        args: ['--ignore=E129,E2,E501']
diff --git a/pyproject.toml b/pyproject.toml
index 2510c48575668d85264847d3568d7a52bbf9a395..dbcec3275e13e1239543c636210f6688915cc8d1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -16,6 +16,13 @@ extend-exclude = '''
 )
 '''
 
+[tool.flake8]
+max-line-length = 89
+max-complexity = 18
+select = B,C,E,F,W,T4,B9
+
+
+
 [tool.coverage]
 #omit =
 #    test_*.py