forked from Cantera/cantera
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (58 loc) · 2.02 KB
/
linters.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Linters
on:
pull_request:
# Build when a pull request targets main
branches:
- main
jobs:
linter:
name: Lint checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
name: Checkout the repository
with:
fetch-depth: 100
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Check example keywords
run: python3 doc/example-keywords.py compare
- name: Get changed C++ files
if: success() || failure()
id: changed-cxx-files
uses: tj-actions/changed-files@v41
with:
files: |
**.h
**.cpp
# Comment blocks starting with "/*!" do not support autobrief
- name: Check for problematic Doxygen comment blocks
if: (success() || failure()) && steps.changed-cxx-files.outputs.any_changed == 'true'
run: |
RETCODE=0
for file in ${{ steps.changed-cxx-files.outputs.all_changed_files }}; do
RESULT=`perl -0777 -ne 'while(m/\n\n *\/\*!.*?\*\//gs){print "$&\n";}' $file`
if [ "$RESULT" ]; then
echo ------ ${file} ------
echo "$RESULT"
RETCODE=1
fi
done
exit $RETCODE
- name: Whitespace errors
if: success() || failure()
run: |
# These are files that should be ignored for whitespace checks
echo ".gitmodules -diff" >> .gitattributes
echo "*.sln -diff" >> .gitattributes
echo "test/data/*.inp -diff" >> .gitattributes
echo "test/data/*.xml -diff" >> .gitattributes
echo "test/data/*.cti -diff" >> .gitattributes
echo "test_problems/**/*blessed* -diff" >> .gitattributes
git config --global core.autocrlf false
git config --global core.whitespace \
-cr-at-eol,tab-in-indent,blank-at-eol,blank-at-eof
git diff --check ${{ github.event.pull_request.base.sha }}