Skip to content

Commit

Permalink
Add cmake lint
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Nov 30, 2023
1 parent d7300de commit b85a343
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 148 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/suggest_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,20 @@ jobs:
run: pre-commit run --all-files --show-diff-on-failure

- name: Check for changes
run: git diff --exit-code || echo "changes=true" >> $GITHUB_ENV
id: check_for_changes
run: |
set +e
git diff --exit-code
echo "exitcode=$?" >> $GITHUB_OUTPUT
- name: Add changed files
if: env.changes == 'true'
if: ${{ steps.check_for_changes.exitcode == '1' }}
run: |
git checkout -b update_dependencies
git commit -a -m "Update style dependencies"
- name: Create pull request
if: env.changes == 'true'
if: ${{ steps.check_for_changes.exitcode == '1' }}
run: gh pr create -B main -H update_dependencies --title 'Update style dependencies'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ repos:
rev: v17.0.5
hooks:
- id: clang-format
args: [ --style=file, --Werror]
exclude: .json

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.10
hooks:
- id: cmake-format
- id: cmake-lint
exclude: FindFilesystem
args: [ "--disable:C0301,C0111,C0113" ]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ If you checked out submodules without having git lfs installed, you can force gi
git submodule foreach "git lfs pull"
```


### Style requirements

There are a set of style requirements, which are gathered in the `pre-commit`
configuration, to have it automatically run on each commit do:

``` sh
$ pip install pre-commit
$ pre-commit install
```

### Trouble with setup

If you encounter problems during install, try deleting the `_skbuild` folder before reinstalling.
Expand Down
145 changes: 0 additions & 145 deletions script/clang-format

This file was deleted.

0 comments on commit b85a343

Please sign in to comment.