mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-19 11:01:39 -07:00
configuring black
This commit is contained in:
parent
f4adf172e3
commit
45d05be034
2 changed files with 61 additions and 11 deletions
35
data/data-pipeline/.pre-commit-config.yaml
Normal file
35
data/data-pipeline/.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.3.0
|
||||||
|
hooks:
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: requirements-txt-fixer
|
||||||
|
|
||||||
|
- repo: https://github.com/lucasmbrown/mirrors-autoflake
|
||||||
|
rev: v1.3
|
||||||
|
hooks:
|
||||||
|
- id: autoflake
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"--in-place",
|
||||||
|
"--remove-all-unused-imports",
|
||||||
|
"--remove-unused-variable",
|
||||||
|
"--ignore-init-module-imports",
|
||||||
|
]
|
||||||
|
|
||||||
|
- repo: https://github.com/asottile/reorder_python_imports
|
||||||
|
rev: v3.8.3
|
||||||
|
hooks:
|
||||||
|
- id: reorder-python-imports
|
||||||
|
language_version: python3.9
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"--application-directories=.",
|
||||||
|
]
|
||||||
|
|
||||||
|
- repo: https://github.com/ambv/black
|
||||||
|
rev: 22.8.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
language_version: python3.9
|
|
@ -252,6 +252,21 @@ Each run can take a while to build the whole environment. If you'd like to save
|
||||||
you can use the previously built environment by running `poetry run tox -e lint`
|
you can use the previously built environment by running `poetry run tox -e lint`
|
||||||
which will drastically speed up the process.
|
which will drastically speed up the process.
|
||||||
|
|
||||||
|
### Configuring pre-commit hooks
|
||||||
|
|
||||||
|
To promote consistent code style and quality, we use git pre-commit hooks to automatically lint and reformat our
|
||||||
|
code before every commit we make to the codebase. Pre-commit hooks are defined in
|
||||||
|
[`.pre-commit-config.yaml`](../.pre-commit-config.yaml).
|
||||||
|
|
||||||
|
1. First, install [`pre-commit`](https://pre-commit.com/) globally:
|
||||||
|
|
||||||
|
$ brew install pre-commit
|
||||||
|
|
||||||
|
2. Run `pre-commit install` to install the specific git hooks used in this repository.
|
||||||
|
|
||||||
|
Now, any time you commit code to the repository, the hooks will run on all modified files automatically. If you wish,
|
||||||
|
you can force a re-run on all files with `pre-commit run --all-files`.
|
||||||
|
|
||||||
### The Application entrypoint
|
### The Application entrypoint
|
||||||
|
|
||||||
After installing the poetry dependencies, you can see a list of commands with the following steps:
|
After installing the poetry dependencies, you can see a list of commands with the following steps:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue