34
loading...
This website collects cookies to deliver better user experience
pre-commit
requires a .pre-commit-config.yaml
to be placed in a repository however to avoid updating the .gitignore
file for every new repository you wish to interactive with, the best solution i found was to add the following to a global .gitignore
.> vim ~/.gitignore
.pre-commit-config.yaml
.codespellrc
codespell
. ---
# .pre-commit-config.yaml
# ========================
#
# pre-commit clean
# pre-commit install
# pre-commit install-hooks
#
# precommit hooks installation
#
# - pre-commit autoupdate
#
# - pre-commit run black
#
# continuous integration
# ======================
#
# - pre-commit run --all-files
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- id: check-merge-conflict
- id: sort-simple-yaml
- id: fix-encoding-pragma
args: ["--remove"]
- id: forbid-new-submodules
- id: mixed-line-ending
args: ["--fix=lf"]
description: Forces to replace line ending by the UNIX 'lf' character.
- id: check-added-large-files
args: ["--maxkb=500"]
- id: no-commit-to-branch
args: [--branch, master]
- id: check-yaml
- id: check-json
files: ^tests/app/
- id: pretty-format-json
args: ["--no-sort-keys", "--autofix"]
files: ^tests/app/
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/ambv/black
rev: 21.5b1
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/PyCQA/bandit
rev: 1.7.0
hooks:
- id: bandit
description: Security oriented static analyser for python code
exclude: tests/|scripts/
args:
- -s
- B101
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
name: codespell
description: Checks for common misspellings in text files.
entry: codespell
language: python
types: [text]
- repo: https://github.com/asottile/pyupgrade
rev: v2.19.4
hooks:
- id: pyupgrade
codespell
, you will need to add a .codespellrc
file to the root of your repository:[codespell]
quiet-level = 3
count =
check-hidden =
check-filenames =
enable-colors =
builtin = clear,rare,informal,code,names
ignore-words-list = pullrequest
pre-commit install
pre-commit run --all
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Debug Statements (Python)................................................Passed
Check for merge conflicts................................................Passed
Sort simple YAML files...............................(no files to check)Skipped
Fix python encoding pragma...............................................Passed
Forbid new submodules....................................................Passed
Mixed line ending........................................................Passed
Check for added large files..............................................Passed
Don't commit to branch...................................................Passed
Check Yaml...............................................................Passed
Check JSON...........................................(no files to check)Skipped
Pretty format JSON...................................(no files to check)Skipped
Check hooks apply to the repository..................(no files to check)Skipped
Check for useless excludes...........................(no files to check)Skipped
black....................................................................Passed
bandit...................................................................Passed
codespell................................................................Passed
pyupgrade................................................................Passed
--no-verify
flag onto your commit to skip it.git commit -m "do the thing" --no-verify