add ci script to scan for unexpected printf statements
This commit is contained in:
10
.github/workflows/sanitizer.yml
vendored
10
.github/workflows/sanitizer.yml
vendored
@@ -57,3 +57,13 @@ jobs:
|
||||
- name: test
|
||||
run: cd build/bin && ./unit
|
||||
shell: bash
|
||||
|
||||
job3:
|
||||
name: printf-sanitizer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: run scan_printf script
|
||||
run: ./scripts/scan_printf.sh
|
||||
shell: bash
|
||||
|
||||
20
scripts/scan_printf.sh
Executable file
20
scripts/scan_printf.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATHS="include code"
|
||||
FILTER_INCLUDE='\*.{c,cpp,h}'
|
||||
FILTER_EXCLUDE="{include/assimp/Compiler/pstdint.h,code/AssetLib/M3D/m3d.h}"
|
||||
|
||||
PATTERN='^\s*printf'
|
||||
|
||||
grep \
|
||||
--include=\*.{c,cpp,h} \
|
||||
--exclude={include/assimp/Compiler/pstdint.h,code/AssetLib/M3D/m3d.h} \
|
||||
-rnw include code \
|
||||
-e '^\s*printf'
|
||||
|
||||
if [ $? ]
|
||||
then
|
||||
echo "Debug statement(s) detected. Please remove, or manually add to exclude filter, if appropriate"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user