What is `pre-commit`, and what hooks are standard for Python repos?
IntermediateConceptTesting, services & metrics
Answer
pre-commit manages Git hooks defined in .pre-commit-config.yaml, running checks on staged files before each commit. Typical hooks: ruff (lint + format), mypy, check-yaml, end-of-file-fixer, detect-private-key, gitleaks for secrets, bandit for security issues. Run pre-commit run --all-files in CI as well, since local hooks can be skipped with --no-verify.
More on Testing, services & metrics
Why should automation scripts have tests at all?BeginnerHow does pytest discover and run tests?BeginnerWhy does pytest use plain `assert` instead of `assertEqual`?BeginnerWhat are pytest fixtures, and what scopes exist?IntermediateWhat built-in fixtures do you use most?IntermediateHow does `@pytest.mark.parametrize` work?Beginner