Skip to content

Commit

Permalink
Merge pull request #3915 from Holzhaus/qmlformat-pre-commit
Browse files Browse the repository at this point in the history
pre-commit: Add hooks for qmllint and qmlformat
  • Loading branch information
uklotzde authored May 26, 2021
2 parents 1169734 + 4dcf6cb commit fa721b1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ jobs:
pre-commit:
name: Detecting code style issues
runs-on: ubuntu-latest
# The Dockerfile for this container can be found at:
# https://github.com/Holzhaus/mixxx-ci-docker
container: holzhaus/mixxx-ci:20210526
steps:
- name: "Check out repository"
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: "Set up Python"
uses: actions/setup-python@v2

- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-format-10

- name: "Detect code style issues (push)"
uses: pre-commit/[email protected]
if: github.event_name == 'push'
Expand All @@ -28,16 +25,24 @@ jobs:
# on Pull Requests!).
env:
SKIP: end-of-file-fixer,trailing-whitespace,clang-format,eslint,no-commit-to-branch
with:
# Enable extra hooks that require special system dependencies that we
# cannot expect to be installed on all contributor's systems.
extra_args: --hook-stage manual --all-files

- name: "Detect code style issues (pull_request)"
uses: pre-commit/[email protected]
if: github.event_name == 'pull_request'
env:
SKIP: no-commit-to-branch
with:
# Enable extra hooks that require special system dependencies that are
# available in our custom docker container, but cannot be expected to
# be installed on all contributor's systems.
#
# HEAD is the not yet integrated PR merge commit +refs/pull/xxxx/merge
# HEAD^1 is the PR target branch and HEAD^2 is the HEAD of the source branch
extra_args: --from-ref HEAD^1 --to-ref HEAD
extra_args: --hook-stage manual --from-ref HEAD^1 --to-ref HEAD

- name: "Generate patch file"
if: failure()
Expand Down
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,23 @@ repos:
stages:
- commit
- manual
- id: qmlformat
name: qmlformat
entry: qmlformat -i
pass_filenames: true
require_serial: true
language: system
types: [text]
files: ^.*\.qml$
# Not enabled in commit stage by default, because qmlformat requires Qt
# 5.15 to be installed
stages:
- manual
- id: qmllint
name: qmllint
entry: qmllint
pass_filenames: true
require_serial: true
language: system
types: [text]
files: ^.*\.qml$

0 comments on commit fa721b1

Please sign in to comment.