pre-commit scripts¶
- pre-commit-hooks
The pre-commit framework already comes with a whole range of scripts, including:
check-added-large-filesprevents large files from being transferred
check-case-conflictlooks for files that would conflict in case-insensitive file systems
check-executables-have-shebangsmakes sure that (non-binary) executables have a shebang line
check-shebang-scripts-are-executablemakes sure (non-binary) files are executable with a shebang line
check-merge-conflictsearches for files containing merge-conflict strings
check-symlinkschecks for symlinks that don’t point to anything
destroyed-symlinksdetects symlinks that have been changed into regular files with the contents of the path the symlink points to.
no-commit-to-branchprotects branches before committing
- pygrep-hooks
provides regular expressions for Python and reStructuredText, including:
python-no-log-warnsearch for the deprecated
.warn()method of Python loggerspython-use-type-annotationsforces type-annotations to be used instead of type-comments
rst-backticksdetects the use of single backticks when writing reStructuredText
rst-directive-colonsdetects that reStructuredText directives do not end with a colon or a space before the colon
rst-inline-touching-normaldetects that inline code is used in normal text in reStructuredText
text-unicode-replacement-charprevents files that contain UTF-8 Unicode Replacement Characters
- Linters and formatters
They are provided in separate repositories, including:
- autopep8
provides autopep8 for the pre-commit framework
- mypy
provides mypy
- pyproject-fmt
formats
pyproject.tomlfiles- validate-pyproject
checks
pyproject.tomlfiles- sp-repo-review
evaluates existing repos against the Scientific Python guidelines.
- clang-format
provides clang-format-wheel
- csslint
provides csslint
- scss-lint
provides scss-lint
- eslint
provides eslint
- fixmyjs
provides fixmyjs
- prettier
provides prettier
- black
for formatting Python code
blackPython code formatter
black-jupyterPython code formatter for Jupyter notebooks
- Python Code Quality Authority
Code quality tools (and plugins) for the Python programming language:
- flake8
promotes the enforcement of a consistent Python style
- autoflake
removes unused imports and unused variables from Python code
- bandit
tool for finding security vulnerabilities in Python code
- pydocstyle
static analysis tool to check compliance with Python docstring conventions
- docformatter
formats docstrings according to PEP 257
- pylint
Python linter
- doc8
executes doc8 for linting documents
- prospector
analyses Python code with prospector
- isort
sorts Python imports
- nbQA
runs isort, pyupgrade, mypy, pylint, flake8 and more on Jupyter notebooks:
nbqaruns any standard Python code quality tool on a Jupyter notebook
nbqa-blackruns
blackon a Jupyter notebooknbqa-check-astruns
check-aston a Jupyter notebooknbqa-flake8runs
flake8on a Jupyter notebooknbqa-isortruns
isorton a Jupyter notebooknbqa-mypyruns
mypyon a Jupyter notebooknbqa-pylintruns
pylinton a Jupyter notebooknbqa-pyupgraderuns
ppyupgradeon a Jupyter notebooknbqa-yapfruns
yapfon a Jupyter notebooknbqa-autopep8runs
autopep8on a Jupyter notebooknbqa-pydocstyleruns
pydocstyleon a Jupyter notebooknbqa-ruffruns
ruffon a Jupyter notebook
- blacken-docs
applies
blackto Python code blocks in documentation files
Miscellaneous
- pyupgrade
automatically updates the syntax for newer versions
- reorder-python-imports
reorders imports into Python files
- dead
detects dead Python code
- python-safety-dependencies-check
analyses Python requirements for known security vulnerabilities
- gitlint
Git commit message linter
- nbstripout
removes the output of Jupyter Notebooks
- ripsecrets
prevents secret keys from being included in your source code
- detect-secrets
detects high entropy strings that are likely to be passwords
- pip-compile
automatically compiles requirements
- kontrolilo
Tool to control licences for OSS dependencies