Skip to content

Commit

Permalink
Added a tidy script
Browse files Browse the repository at this point in the history
  • Loading branch information
grunt-lucas committed Aug 1, 2023
1 parent 86b8830 commit d334255
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ clean:
$(RM) -r $(RELEASE) $(DEBUG)
$(RM) default.profraw testcov.profdata

tidy:
clang-tidy -checks='cert-*' -header-filter='.*' $(SRC_FILES) -- --std=c++20 -Iinclude $(pkg-config --cflags libpng) -Idoctest-2.4.11 -Ipng++-0.2.9 -Ifmt-10.0.0/include

release: $(RELEASE_TARGET) $(RELEASE_TEST_TARGET)
@:

Expand Down
55 changes: 55 additions & 0 deletions tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

set -Eeuo pipefail

usage() {
cat <<EOF
Usage: tidy.sh <file ...>
tidy.sh --help
Run \`clang-tidy' on the provided source files.
Options:
-h, --help Print this help and exit.
EOF
}

usage_exit_ok() {
usage
exit
}

usage_exit_error() {
usage
exit 1
}

parse_params() {
while :; do
case "${1-}" in
-h | --help) usage_exit_ok ;;
-?*) die "Unknown option: $1" ;;
*) break ;;
esac
shift
done

args=("$@")
[[ ${#args[@]} -lt 1 ]] && usage_exit_error

return 0
}

parse_params "$@"
clang-tidy \
-checks='cert-*' \
-header-filter='.*' \
"${args[@]}" \
-- \
--std=c++20 \
-Iinclude \
$(pkg-config --cflags libpng) \
-Idoctest-2.4.11 \
-Ipng++-0.2.9 \
-Ifmt-10.0.0/include

0 comments on commit d334255

Please sign in to comment.