mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 04:30:06 +01:00
Add pre-commit hooks
This ensures a few things are correct before we commit and/or push, making life a bit easier for both our contributors and our maintainers since some things should no longer end up in the MRs. Activate via: $ pre-commit install $ pre-commit install --hook-type pre-push The latter is required for the ci-templates hooks which are pre-push only.
This commit is contained in:
parent
bf59231f23
commit
53517dccb8
2 changed files with 32 additions and 0 deletions
23
.pre-commit-config.yaml
Normal file
23
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- id: no-commit-to-branch
|
||||
args: ['--branch', 'main']
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.10.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ['--check', '--diff', '.']
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: v0.0.254
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ['--ignore=E741,E501', '.']
|
||||
- repo: https://gitlab.freedesktop.org/freedesktop/ci-templates.git
|
||||
rev: 7402203527f61d6473d55ad701172d1606508c52
|
||||
hooks:
|
||||
- id: check-commits
|
||||
- id: generate-template
|
||||
|
|
@ -79,6 +79,15 @@ You can omit the last step if you only want to test locally.
|
|||
Working on the code
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you are planning to send patches, it's a good idea to set up
|
||||
`pre-commit <https://pre-commit.com/>`_ with these commands::
|
||||
|
||||
$> pre-commit install
|
||||
$> pre-commit install --hook-type pre-push
|
||||
|
||||
This will check a few things before you commit and/or push to your repos to
|
||||
reduce the turnaround time for some common mistakes.
|
||||
|
||||
libinput has a roughly three-parts architecture:
|
||||
|
||||
- the front-end code which handles the ``libinput_some_function()`` API calls in ``libinput.c``
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue