Add scripts for checking formatting, linting etc
This commit is contained in:
@@ -4,6 +4,8 @@ project(imp LANGUAGES C)
|
|||||||
|
|
||||||
option(TESTS "Build tests" ON)
|
option(TESTS "Build tests" ON)
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
function(configure_target target)
|
function(configure_target target)
|
||||||
# Set C standard and compile flags
|
# Set C standard and compile flags
|
||||||
set_target_properties(${target} PROPERTIES
|
set_target_properties(${target} PROPERTIES
|
||||||
|
|||||||
4
scripts/build-and-test.sh
Executable file
4
scripts/build-and-test.sh
Executable 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
2
scripts/check-format.sh
Executable 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
3
scripts/lint.sh
Executable 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
6
scripts/list-source-files.sh
Executable 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'
|
||||||
Reference in New Issue
Block a user