summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-02 19:51:41 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-02 19:51:41 -0500
commitf7eede23de6f78b2b33b477b2b4c5451141825d5 (patch)
treed698a92272b8e4a8428b82d9a21f3e98ed267a6d /tools
parent32c722d50943bbdeba65a77d5e94f8692cf75f3c (diff)
Add setup for coverage and cppcheck.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/coverage.sh5
-rwxr-xr-xtools/create-pyenv.sh9
-rwxr-xr-xtools/run-cppcheck.sh46
3 files changed, 60 insertions, 0 deletions
diff --git a/tools/coverage.sh b/tools/coverage.sh
new file mode 100755
index 0000000..5caa6f0
--- /dev/null
+++ b/tools/coverage.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+ctest --test-dir build/test -j8
+mkdir -p build/html
+gcovr --exclude-throw-branches --exclude build/_deps/ --exclude test -r source . --html-details build/html/gcovr_report.html
diff --git a/tools/create-pyenv.sh b/tools/create-pyenv.sh
new file mode 100755
index 0000000..64b1fbf
--- /dev/null
+++ b/tools/create-pyenv.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+PROJ_ROOT=$(git rev-parse --show-toplevel)
+cd $PROJ_ROOT
+
+python3 -m venv fudenv
+. fudenv/bin/activate
+pip install cppcheck-codequality
+deactivate
diff --git a/tools/run-cppcheck.sh b/tools/run-cppcheck.sh
new file mode 100755
index 0000000..1f8ee7d
--- /dev/null
+++ b/tools/run-cppcheck.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# libfud
+# Copyright 2024 Dominick Allen
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+PROJ_ROOT=$(git rev-parse --show-toplevel)
+cd $PROJ_ROOT
+
+COMPILE_COMMANDS='build/compile_commands.json'
+
+cppcheck \
+ --verbose \
+ --inline-suppr \
+ --checkers-report=build/cppcheck-checkers-report.log \
+ --suppress=useStlAlgorithm \
+ --suppress=missingIncludeSystem \
+ --suppress=functionStatic \
+ --suppress=functionConst \
+ --suppress=unusedFunction \
+ --enable=all \
+ --inconclusive \
+ --max-ctu-depth=8 \
+ --check-level=exhaustive \
+ -i build/ \
+ --cppcheck-build-dir=build/ \
+ --project="$COMPILE_COMMANDS" \
+ --verbose \
+ --error-exitcode=2 \
+ --xml 2> build/err.xml
+
+cppcheck-htmlreport --file=build/err.xml --report-dir=build/cppcheck_report --source-dir="$PROJ_ROOT"
+. fudenv/bin/activate
+python3 -m cppcheck_codequality --input-file=build/err.xml --base-dir=$PROJ_ROOT --output-file=build/cppcheck.json
+deactivate