diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..a92e501b --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/doc/user/contributing.rst b/doc/user/contributing.rst index 41f99978..b3ca95df 100644 --- a/doc/user/contributing.rst +++ b/doc/user/contributing.rst @@ -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 `_ 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``