Some out-of-the-box hooks for pre-commit.
Add this to your .pre-commit-config.yaml
- repo: https://github.com/chrysa/pre-commit-tools
rev: '' # Use the ref you want to point at
hooks:
- id: console-debug-detection
- id: console-log-detection
- id: console-table-detection
- id: format-dockerfiles
- id: print-detection
- id: pprint-detection
- id: yaml-sorter
- id: debugger-detection
- id: json-sorter
- id: requirements-sort
- id: env-file-check
- id: logger-detection- add shebang
# syntax=docker/dockerfile:1.4if missing - group consecutive same command without space
- group consecutive
RUNorENVon one command line with new line
- separate block for literal ARGS and ARGS composed with variable
- order alphabetically ARGS
- order alphabetically ENV
- add config file support
detect print on python code if is not commented or escaped with # print-detection: disable
detect pprint on python code if is not commented or escaped with # pprint-detection: disable
generate pylint html reports
use --output-json to define json output and --output-html to specify html output
use --output-json= to define json output and --output-html= to specify html output
Sort YAML file keys alphabetically (recursive). Modifies files in-place and returns 1 if any file was changed.
Use # yaml-sorter: disable is not supported — simply exclude the file in your .pre-commit-config.yaml.
use --output-json to define json output and --output-html to specify html output
Detect debugger statements (breakpoint(), pdb.set_trace(), ipdb.set_trace(), pudb.set_trace()) in Python files.
Use # debugger-detection: disable to ignore a specific line.
Sort JSON file keys alphabetically (recursive). Modifies files in-place and returns 1 if any file was changed.
Sort requirements*.txt files alphabetically (comments and blank lines first, then packages sorted case-insensitively). Modifies files in-place and returns 1 if any file was changed.
Detect potential secrets committed in .env files (passwords, tokens, API keys, etc.).
Placeholder values (<value>, ${VAR}, changeme, etc.) are ignored.
Detect direct use of the root logging module (e.g. logging.info(...)) instead of a named logger.
Use # logger-detection: disable to ignore a specific line.