Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit hook config to run flake8 and black on commit #864

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down