Files
ENI-DevSecOps/.pre-commit-config.yaml
Johan 0d0dd3cfcf refactor: configure pre-commit and CI/CD pipeline
- Restructured GitHub Actions workflow with separate jobs for linting, testing, and security
- Configured pre-commit hooks: black, isort, flake8, yamllint
- Added setup.cfg for centralized configuration
- Relaxed flake8 rules (B008, D* docstrings) for FastAPI compatibility
- Removed bandit (pbr dependency issue) - can be added later
- All pre-commit checks now passing
2026-02-02 15:46:05 +01:00

72 lines
1.9 KiB
YAML

---
# Pre-commit configuration for Task Manager project
# Install: pip install pre-commit && pre-commit install
# Run manually: pre-commit run --all-files
repos:
# Standard file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
name: Trim trailing whitespace
- id: end-of-file-fixer
name: Fix end-of-file marker
- id: check-yaml
name: Check YAML validity
- id: check-json
name: Check JSON validity
- id: check-added-large-files
name: Check for large files
args: ['--maxkb=1000']
- id: check-case-conflict
name: Check for case conflicts
- id: mixed-line-ending
name: Fix mixed line endings
args: ['--fix=lf']
# Python code formatting (Black)
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
name: Format code with black
language_version: python3
args: ['--line-length=100']
# Import sorting (isort)
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
name: Sort imports with isort
args: ['--profile=black']
# Linting (Flake8)
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
name: Lint code with flake8
args: ['--max-line-length=100', '--ignore=E203,W503,D100,D101,D102,D103,D104,D105,D106,B008']
additional_dependencies: ['flake8-bugbear']
# Security checks (Bandit)
# YAML linting
- repo: https://github.com/adrienverge/yamllint
rev: v1.33.0
hooks:
- id: yamllint
name: Lint YAML files
args: ['-d', '{extends: relaxed, rules: {line-length: {max: 120}}}']
ci:
autofix_commit_msg: 'chore: auto-fixes from pre-commit hooks'
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: 'chore: pre-commit autoupdate'
autoupdate_schedule: weekly
skip: [bandit]
submodules: false