Python pre-commit pipeline to enforce best practices. (#8181)

* Ãmade config files for black and flake8 pre-commit pipeline

* added documentation for pre-commit pipeline

* Mitigates tag change error

* removed black version in pre commit config

* Add E711 to the list of ignored flake8 errors

See #330

Co-authored-by: Lukas Molleman <Lukas.Molleman@gmail.com>
Co-authored-by: Andrew Noyes <andrew.noyes@snowflake.com>
This commit is contained in:
LukasMoll
2022-09-30 22:18:55 +02:00
committed by GitHub
parent 88be74732f
commit d5fb11eccb
3 changed files with 17 additions and 0 deletions

5
.flake8 Normal file
View File

@@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401, E711
max-line-length = 79
max-complexity = 18
select = B,C,E,F,W,T4,B9

9
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 2018e667a6a36ee3fbfa8041cd36512f92f60d49 # frozen: 22.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: f8e1b317742036ff11ff86356fd2b68147e169f7 # frozen: 5.0.4
hooks:
- id: flake8

View File

@@ -38,6 +38,9 @@ We love pull requests! For minor changes, feel free to open up a PR directly. Fo
CI will be run automatically for core committers, and for community PRs it will be initiated by the request of a core committer. Tests can also be run locally via `ctest`, and core committers can run additional validation on pull requests prior to merging them. CI will be run automatically for core committers, and for community PRs it will be initiated by the request of a core committer. Tests can also be run locally via `ctest`, and core committers can run additional validation on pull requests prior to merging them.
### Python pre-commit
We use a pre-commit pipeline with black and flake8 to enforce python best coding practices. Install pre-commit ```pip install pre-commit```. Install it in your FoundationDB directory ```pre-commit install```.
### Reporting issues ### Reporting issues
Please refer to the section below on [using GitHub issues and the community forums](#using-github-issues-and-community-forums) for more info. Please refer to the section below on [using GitHub issues and the community forums](#using-github-issues-and-community-forums) for more info.