| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Some out-of-the-box hooks for pre-commit.
See also: https://github.com/pre-commit/pre-commit
Add this to your .pre-commit-config.yaml
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
# - id: ...Prevent giant files from being committed.
Simply check whether files parse as valid python.
Require literal syntax when initializing empty or zero Python builtin types.
Check for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT.
Checks that non-binary executables have a proper shebang.
Check for files that cannot be created on Windows.
Attempts to load all json files to verify syntax.
Check for files that contain merge conflict strings.
Checks that scripts with shebangs are executable.
Checks for symlinks which do not point to anything.
Attempts to load all TOML files to verify syntax.
Ensures that links to vcs websites are permalinks.
Attempts to load all xml files to verify syntax.
Attempts to load all yaml files to verify syntax.
Check for debugger imports and py37+ breakpoint() calls in python source.
Detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to. This usually happens on Windows when a user clones a repository that has symlinks but they do not have the permission to create symlinks.
Checks for the existence of AWS secrets that you have set up with the AWS CLI. The following arguments are available:
Checks for the existence of private keys.
This hook replaces double quoted strings with single quoted strings.
Makes sure files end in a newline and only a newline.
Sort the lines in specified files (defaults to alphabetical). You must provide the target files as input. Note that this hook WILL remove blank lines and does NOT respect any comments. All newlines will be converted to line feeds (\n).
The following arguments are available:
removes UTF-8 byte order marker
Prevent addition of new git submodules.
This is intended as a helper to migrate away from submodules. If you want to ban them entirely use forbid-submodules
forbids any submodules in the repository.
Replaces or checks mixed line ending.
verifies that test files are named correctly.
Protect specific branches from direct checkins.
Note that no-commit-to-branch is configured by default to always_run. As a result, it will ignore any setting of files, exclude, types or exclude_types. Set always_run: false to allow this hook to be skipped according to these file filters. Caveat: In this configuration, empty commits (git commit --allow-empty) would always be allowed by this hook.
Checks that all your JSON files are pretty. "Pretty" here means that keys are sorted and indented. You can configure this with the following commandline options:
Sorts entries in requirements.txt and constraints.txt and removes incorrect entry for pkg-resources==0.0.0
Sorts simple YAML files which consist only of top-level keys, preserving comments and blocks.
Note that sort-simple-yaml by default matches no files as it enforces a very specific format. You must opt in to this by setting files, for example:
- id: sort-simple-yaml
files: ^config/simple/Trims trailing whitespace.
If you'd like to use these hooks, they're also available as a standalone package.
Simply pip install pre-commit-hooks
| Back | FazBrowse Home | New Git URL |