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
This commit is contained in:
@@ -1,10 +1,71 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
---
|
||||
# Pre-commit configuration for Task Manager project
|
||||
# Install: pip install pre-commit && pre-commit install
|
||||
# Run manually: pre-commit run --all-files
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
# Standard file checks
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user