memgraph/tools/apollo/cppcheck
Matej Ferencevic f2ebd935b9 Added more cppcheck suppressions.
Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D959
2017-11-06 16:04:07 +01:00

33 lines
811 B
Bash
Executable File

#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/../../"
tmpfile="$DIR/.cppcheck_errors.tmp"
errfile="$DIR/.cppcheck_errors"
if [ "$1" == "" ]; then
mode=diff
else
mode=$1
fi
if [ "$mode" == diff ]; then
files=$( git diff --name-only HEAD~1 HEAD | egrep '^(src|tests|poc)' | egrep '.(hpp|h|cpp)$' )
flags=""
else
files=src/
flags="-j$THREADS -Isrc"
fi
cppcheck --enable=all --force --suppress=missingInclude --suppress=unusedFunction --suppress=unusedStructMember $flags $files 2>"$tmpfile"
cat "$tmpfile" | grep -v "(information) Unmatched suppression" > "$errfile"
rm $tmpfile
cat "$errfile" >&2
len="$( cat "$errfile" | wc -l )"
if [ $len -gt 0 ]; then
echo -e "==== Cppcheck errors: ====\n\n\`\`\`\n$( cat "$errfile" )\n\`\`\`" > "$errfile"
fi