Add scripts for checking formatting, linting etc

This commit is contained in:
2025-08-09 15:22:30 +01:00
parent 3e8a9d6789
commit 00d1961d36
5 changed files with 17 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ project(imp LANGUAGES C)
option(TESTS "Build tests" ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
function(configure_target target)
# Set C standard and compile flags
set_target_properties(${target} PROPERTIES

4
scripts/build-and-test.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
cmake --build build
ctest --test-dir build --output-on-failure | grep -v :PASS

2
scripts/check-format.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
scripts/list-source-files.sh | xargs -n1 clang-format --dry-run --Werror

3
scripts/lint.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
scripts/list-source-files.sh \
| xargs -n1 clang-tidy -p build --warnings-as-errors='*'

6
scripts/list-source-files.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
find . \
-not \( -path './.git' -prune \) \
-not \( -path './build' -prune \) \
-not \( -path './dep' -prune \) \
-name '*.c' -o -name '*.h'