Skip to content

Commit ccdaf5d

Browse files
rubenwardysfan5
authored andcommittedMar 1, 2021
Disable clang-format, clean up scripts
1 parent b390bd2 commit ccdaf5d

File tree

3 files changed

+42
-15
lines changed

3 files changed

+42
-15
lines changed
 

‎.github/workflows/cpp_lint.yml

+14-13
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ on:
2424
- '.github/workflows/**.yml'
2525

2626
jobs:
27-
clang_format:
28-
runs-on: ubuntu-18.04
29-
steps:
30-
- uses: actions/checkout@v2
31-
- name: Install clang-format
32-
run: |
33-
sudo apt-get install clang-format-9 -qyy
3427

35-
- name: Run clang-format
36-
run: |
37-
source ./util/ci/lint.sh
38-
perform_lint
39-
env:
40-
CLANG_FORMAT: clang-format-9
28+
# clang_format:
29+
# runs-on: ubuntu-18.04
30+
# steps:
31+
# - uses: actions/checkout@v2
32+
# - name: Install clang-format
33+
# run: |
34+
# sudo apt-get install clang-format-9 -qyy
35+
#
36+
# - name: Run clang-format
37+
# run: |
38+
# source ./util/ci/clang-format.sh
39+
# check_format
40+
# env:
41+
# CLANG_FORMAT: clang-format-9
4142

4243
clang_tidy:
4344
runs-on: ubuntu-18.04

‎util/ci/lint.sh ‎util/ci/clang-format.sh

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#! /bin/bash
2-
function perform_lint() {
3-
echo "Performing LINT..."
2+
3+
function setup_for_format() {
44
if [ -z "${CLANG_FORMAT}" ]; then
55
CLANG_FORMAT=clang-format
66
fi
77
echo "LINT: Using binary $CLANG_FORMAT"
88
CLANG_FORMAT_WHITELIST="util/ci/clang-format-whitelist.txt"
99

1010
files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
11+
}
12+
13+
function check_format() {
14+
echo "Checking format..."
15+
16+
setup_for_format
1117

1218
local errorcount=0
1319
local fail=0
@@ -41,3 +47,18 @@ function perform_lint() {
4147
echo "LINT OK"
4248
}
4349

50+
51+
52+
function fix_format() {
53+
echo "Fixing format..."
54+
55+
setup_for_format
56+
57+
for f in ${files_to_lint}; do
58+
whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
59+
if [ -z "${whitelisted}" ]; then
60+
echo "$f"
61+
$CLANG_FORMAT -i "$f"
62+
fi
63+
done
64+
}

‎util/fix_format.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -e
2+
3+
. ./util/ci/clang-format.sh
4+
5+
fix_format

0 commit comments

Comments
 (0)
Please sign in to comment.