mirror of
https://github.com/data-privacy-stack/presidio.git
synced 2026-08-02 16:20:44 -05:00
1.5 KiB
1.5 KiB
Setting Up a Development Environment
Table of contents
Automatically format code and check for code styling
Presidio services are PEP8 compliant and continuously enforced on style guide issues during the build process using flake8.
Running flake8 locally, using pipenv run flake8, you can check for those issues prior to committing a change.
To make things easier, you can use pre-commit hooks to verify and automatically format code upon a git commit, using black:
-
From the project's root, enable pre-commit, installing git hooks in the
.git/directory:pre-commit install -
Commit non PEP8 compliant code will cause commit failure and automatically format your code using
black, as well as checking code formatting usingflake8> git commit -m 'autoformat' presidio-analyzer/presidio_analyzer/predefined_recognizers/us_ssn_recognizer.py black....................................................................Failed - hook id: black - files were modified by this hook reformatted presidio-analyzer/presidio_analyzer/predefined_recognizers/us_ssn_recognizer.py All done! ✨ 🍰 ✨ 1 file reformatted. flake8...................................................................Passed -
Committing again will finish successfully, with a well-formatted code.