# Pre-commit hooks for ACS Agenda Manager # See https://pre-commit.com for more information # Install: pip install pre-commit && pre-commit install repos: # General hooks - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: trailing-whitespace exclude: ^(lang/.*\.mo|css/images/) - id: end-of-file-fixer exclude: ^(lang/.*\.mo|css/images/) - id: check-yaml - id: check-json - id: check-merge-conflict - id: check-added-large-files args: ['--maxkb=500'] - id: mixed-line-ending args: ['--fix=lf'] # PHP Syntax Check - repo: https://github.com/digitalpulp/pre-commit-php rev: 1.4.0 hooks: - id: php-lint files: \.php$ # PHP CodeSniffer (WordPress Coding Standards) # Requires: composer global require squizlabs/php_codesniffer wp-coding-standards/wpcs # Then: phpcs --config-set installed_paths ~/.composer/vendor/wp-coding-standards/wpcs # Skip this hook if phpcs is not installed by setting SKIP=phpcs - repo: local hooks: - id: phpcs name: PHP CodeSniffer entry: bash -c 'command -v phpcs >/dev/null 2>&1 && phpcs "$@" || echo "phpcs not installed, skipping..." && exit 0' -- language: system files: \.php$ args: - --standard=phpcs.xml - --colors - -s pass_filenames: true # JavaScript/CSS linting - repo: https://github.com/pre-commit/mirrors-eslint rev: v10.0.0-beta.0 hooks: - id: eslint files: \.(js|jsx)$ additional_dependencies: - eslint@8.56.0 - eslint-config-wordpress@2.0.0 # Prettier for consistent formatting - repo: local hooks: - id: prettier name: prettier entry: bash -c 'npx prettier --check "$@" 2>/dev/null || true' -- language: system types_or: [css, javascript] exclude: ^css/images/ # Check for secrets/credentials - repo: https://github.com/Yelp/detect-secrets rev: v1.5.0 hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] exclude: ^(lang/.*|test/) # Shell script linting - repo: https://github.com/shellcheck-py/shellcheck-py rev: v0.11.0.1 hooks: - id: shellcheck files: \.sh$ # Configuration default_language_version: python: python3 node: '18.19.0'