Merge "add pre-commit"
This commit is contained in:
commit
c6afc1bc8f
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
default_language_version:
|
||||
# force all unspecified python hooks to run python3
|
||||
python: python3
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: mixed-line-ending
|
||||
args: ['--fix', 'lf']
|
||||
exclude: '.*\.(svg)$'
|
||||
- id: check-byte-order-marker
|
||||
- id: check-merge-conflict
|
||||
- id: debug-statements
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: flake8
|
||||
name: flake8
|
||||
additional_dependencies:
|
||||
- hacking>=3.0.1,<3.1.0
|
||||
language: python
|
||||
entry: flake8
|
||||
files: '^.*\.py$'
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
15
HACKING.rst
15
HACKING.rst
|
@ -45,3 +45,18 @@ Masakari Specific Commandments
|
|||
- [M332] Yield must always be followed by a space when yielding a value.
|
||||
- [M333] Policy registration should be in the central location ``masakari/policies/``
|
||||
- [M334] Do not use the oslo_policy.policy.Enforcer.enforce() method.
|
||||
|
||||
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