Fix formatting with black
This commit is contained in:
parent
d1b60790d6
commit
635feb6a5b
3
.flake8
Normal file
3
.flake8
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[flake8]
|
||||||
|
max-line-length = 88
|
||||||
|
exclude = .git,__pycache__,venv,.venv
|
@ -30,8 +30,14 @@ lint:
|
|||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- source $VIRTUAL_ENV/bin/activate
|
- source $VIRTUAL_ENV/bin/activate
|
||||||
- pip install pre-commit
|
- pip install pre-commit black flake8
|
||||||
- pre-commit run --all-files || (echo "Auto-fixing formatting issues" && black backend/ && git diff && exit 1)
|
# Run pre-commit hooks
|
||||||
|
- pre-commit run --all-files || (
|
||||||
|
echo "Auto-fixing formatting issues with black..." &&
|
||||||
|
black backend/ && # Fix formatting locally
|
||||||
|
git diff && # Show fixes in pipeline output
|
||||||
|
exit 1 # Fail the job to indicate changes are needed
|
||||||
|
)
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 23.7.0
|
rev: 23.7.0 # Use the latest stable release
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args: [--diff] # Run with `--diff` in CI to avoid unnecessary changes
|
args: ["--check"]
|
||||||
always_run: true # Always run this hook, even if nothing was staged
|
pass_filenames: false # Ensures it lints every file, even if staged differently
|
||||||
- id: black
|
always_run: true # Always runs regardless of file changes
|
||||||
args: [--quiet]
|
|
||||||
stages: [commit] # Recommend full reformat for local development only
|
|
||||||
|
|
||||||
- repo: https://github.com/pycqa/flake8
|
- repo: https://github.com/pycqa/flake8
|
||||||
rev: 6.1.0 # Use the latest stable version
|
rev: 6.1.0 # Use the latest stable release
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
args: []
|
args: []
|
Loading…
x
Reference in New Issue
Block a user