diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..7376c5aca1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: + - repo: https://github.com/pycqa/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + language_version: python3 + args: [ + '--extend-ignore=E203,W503', + '--max-line-length=100' + ] + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + language_version: python3 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e0aefced6f..78c471e33b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,6 +95,13 @@ Run the following commands from the root of the Parsons repository to lint your > black parsons ``` +Pre-commit hooks are available to enforce black and isort formatting on +commit. You can also set up your IDE to reformat using black and/or isort on +save. + +To set up the pre-commit hooks, install pre-commit with `pip install +pre-commit`, and then run `pre-commit install`. + #### Coding Conventions The following is a list of best practices to consider when writing code for the Parsons project: