Some drivers use clang-format exclusively. We would like to lint for correct
formatting in CI to catch style issues before they land, because mixing
clang-format and not clang-format within a codebase is a recipe for conflicts.
We don't expect this lint to ever fail in "normal" usage, since we expect
developers on these drivers to setup automatic formatting in their editor.
However, it can be useful as a failsafe or for drive-by contributors who don't
know the style guide.
Enable the linting for Asahi. We'll enable for Panfrost shortly, but Panfrost
isn't clang-format clean quite yet.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20553>
- changes:
- src/**/*.rs
when: on_success
+
+.lint-clang-format-rules:
+ rules:
+ - !reference [.core-rules, rules]
+ - changes:
+ - src/**/asahi/**/*
+ when: on_success
- shopt -s globstar
- rustfmt --check --verbose src/**/*.rs
+clang-format:
+ # Cancel job if a newer commit is pushed to the same branch
+ interruptible: true
+ stage: lint
+ extends:
+ - .use-debian/x86_build
+ - .lint-clang-format-rules
+ variables:
+ GIT_STRATEGY: fetch
+ script:
+ - shopt -s globstar
+ - clang-format-13 --Werror --dry-run src/**/asahi/**/*.{h,c,cpp}
+
.test-gl:
extends:
- .test