Add pre-commit
Change-Id: I3fda3d18cea0e22e2999481551429122619b2144
This commit is contained in:
parent
409c4bca77
commit
e150e032e9
32
.pre-commit-config.yaml
Normal file
32
.pre-commit-config.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: 3298ddab3c13dd77d6ce1fc0baf97691430d84b0 # v4.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
# Replaces or checks mixed line ending
|
||||
- id: mixed-line-ending
|
||||
args: ['--fix', 'lf']
|
||||
exclude: '.*\.(svg)$'
|
||||
- id: end-of-file-fixer
|
||||
# Forbid files which have a UTF-8 byte-order marker
|
||||
- id: check-byte-order-marker
|
||||
# Checks that non-binary executables have a proper shebang
|
||||
- id: check-executables-have-shebangs
|
||||
# Check for files that contain merge conflict strings.
|
||||
- id: check-merge-conflict
|
||||
- id: debug-statements
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
- id: check-added-large-files
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: flake8
|
||||
name: flake8
|
||||
additional_dependencies:
|
||||
- hacking>=3.1.0,<3.2.0
|
||||
language: python
|
||||
entry: flake8
|
||||
files: '^.*\.py$'
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
15
HACKING.rst
15
HACKING.rst
@ -149,3 +149,18 @@ By "industry standards" we either mean RFCs or well-established best practices.
|
||||
We are generally not interested in defining new standards if a prior open
|
||||
standard already exists. We should also avoid doing things which directly
|
||||
or indirectly contradict established standards.
|
||||
|
||||
Use of pre-commit checks
|
||||
------------------------
|
||||
`pre-commit`_ is a software tool that allows us to manage pre-commit checks as
|
||||
part of the Git repository's configuration
|
||||
and to run checks as Git pre-commit hooks (or other types of Git hooks)
|
||||
automatically on developer machines.
|
||||
It helps to catch and fix common issues before they get pushed to the server.
|
||||
After the installation of the tool (e.g. on Fedora via
|
||||
`sudo dnf install pre-commit`) simply `cd` to the Git repository and run
|
||||
`pre-commit install` to let the tool install its Git pre-commit hook.
|
||||
From now on these predefined checks will run on files that you change in new
|
||||
Git commits.
|
||||
|
||||
.. _pre-commit: https://pre-commit.com/
|
||||
|
Loading…
Reference in New Issue
Block a user