mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-06 12:38:14 +02:00
Add pre-commit support to CI
This will help to make sure that style things that are enforced by pre-commit are set appropriately.
This commit is contained in:
parent
59d5116f9d
commit
9a4229339b
2 changed files with 49 additions and 0 deletions
|
|
@ -1,6 +1,8 @@
|
|||
image: fedora:rawhide
|
||||
|
||||
variables:
|
||||
PRECOMMIT: pre-commit
|
||||
git
|
||||
DEPENDENCIES: gcc
|
||||
gcovr
|
||||
gtk-doc
|
||||
|
|
@ -25,6 +27,13 @@ workflow:
|
|||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||
- if: $CI_PIPELINE_SOURCE == 'push'
|
||||
|
||||
pre_commit:
|
||||
before_script:
|
||||
- dnf update -y
|
||||
- if [ -x /bin/dnf ]; then dnf install -y $PRECOMMIT; else dnf5 install -y $PRECOMMIT; fi
|
||||
script:
|
||||
- pre-commit run --all-files
|
||||
|
||||
build_stable:
|
||||
before_script:
|
||||
- dnf update -y
|
||||
|
|
|
|||
40
.pre-commit-config.yaml
Normal file
40
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
default_stages: [commit]
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: no-commit-to-branch
|
||||
args: [--branch, main]
|
||||
- id: check-added-large-files
|
||||
- id: check-byte-order-marker
|
||||
- id: check-executables-have-shebangs
|
||||
- id: forbid-new-submodules
|
||||
- id: check-yaml
|
||||
- id: check-json
|
||||
- id: pretty-format-json
|
||||
args: ['--no-sort-keys']
|
||||
- id: check-symlinks
|
||||
- id: check-xml
|
||||
- id: end-of-file-fixer
|
||||
types_or: [c, shell, python]
|
||||
- id: trailing-whitespace
|
||||
types_or: [c, shell, python, xml]
|
||||
- id: check-docstring-first
|
||||
- id: check-merge-conflict
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.2.6
|
||||
hooks:
|
||||
- id: codespell
|
||||
args: ['--write-changes']
|
||||
# disabled until amdgpu panel power action is merged
|
||||
#- repo: https://github.com/ambv/black
|
||||
# rev: 23.12.0
|
||||
# hooks:
|
||||
# - id: black
|
||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||
rev: v0.38.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
args: ['--fix']
|
||||
Loading…
Add table
Reference in a new issue