summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2021-01-23 23:48:22 +0000
committersfan5 <sfan5@live.de>2021-03-01 12:12:52 +0100
commitccdaf5de54108990fcdeb0b0ff4a4fc4cd998522 (patch)
treecfb2eb5b560bcdc955df7e618e25b828924ea927
parentb390bd2ea5c40cb96af1699a6a18f59dcdb1495b (diff)
downloadminetest-ccdaf5de54108990fcdeb0b0ff4a4fc4cd998522.tar.gz
minetest-ccdaf5de54108990fcdeb0b0ff4a4fc4cd998522.tar.bz2
minetest-ccdaf5de54108990fcdeb0b0ff4a4fc4cd998522.zip
Disable clang-format, clean up scripts
-rw-r--r--.github/workflows/cpp_lint.yml27
-rwxr-xr-xutil/ci/clang-format.sh (renamed from util/ci/lint.sh)25
-rwxr-xr-xutil/fix_format.sh5
3 files changed, 42 insertions, 15 deletions
diff --git a/.github/workflows/cpp_lint.yml b/.github/workflows/cpp_lint.yml
index 1f97d105a..2bd884c7a 100644
--- a/.github/workflows/cpp_lint.yml
+++ b/.github/workflows/cpp_lint.yml
@@ -24,20 +24,21 @@ on:
- '.github/workflows/**.yml'
jobs:
- clang_format:
- runs-on: ubuntu-18.04
- steps:
- - uses: actions/checkout@v2
- - name: Install clang-format
- run: |
- sudo apt-get install clang-format-9 -qyy
- - name: Run clang-format
- run: |
- source ./util/ci/lint.sh
- perform_lint
- env:
- CLANG_FORMAT: clang-format-9
+# clang_format:
+# runs-on: ubuntu-18.04
+# steps:
+# - uses: actions/checkout@v2
+# - name: Install clang-format
+# run: |
+# sudo apt-get install clang-format-9 -qyy
+#
+# - name: Run clang-format
+# run: |
+# source ./util/ci/clang-format.sh
+# check_format
+# env:
+# CLANG_FORMAT: clang-format-9
clang_tidy:
runs-on: ubuntu-18.04
diff --git a/util/ci/lint.sh b/util/ci/clang-format.sh
index 395445ca7..89576c656 100755
--- a/util/ci/lint.sh
+++ b/util/ci/clang-format.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-function perform_lint() {
- echo "Performing LINT..."
+
+function setup_for_format() {
if [ -z "${CLANG_FORMAT}" ]; then
CLANG_FORMAT=clang-format
fi
@@ -8,6 +8,12 @@ function perform_lint() {
CLANG_FORMAT_WHITELIST="util/ci/clang-format-whitelist.txt"
files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
+}
+
+function check_format() {
+ echo "Checking format..."
+
+ setup_for_format
local errorcount=0
local fail=0
@@ -41,3 +47,18 @@ function perform_lint() {
echo "LINT OK"
}
+
+
+function fix_format() {
+ echo "Fixing format..."
+
+ setup_for_format
+
+ for f in ${files_to_lint}; do
+ whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
+ if [ -z "${whitelisted}" ]; then
+ echo "$f"
+ $CLANG_FORMAT -i "$f"
+ fi
+ done
+}
diff --git a/util/fix_format.sh b/util/fix_format.sh
new file mode 100755
index 000000000..3cef6f58d
--- /dev/null
+++ b/util/fix_format.sh
@@ -0,0 +1,5 @@
+#!/bin/bash -e
+
+. ./util/ci/clang-format.sh
+
+fix_format