Added cppcheck.
Reviewers: buda, mislav.bradac Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D597
This commit is contained in:
parent
68e78c417b
commit
a0baed4280
1
tools/apollo/.gitignore
vendored
Normal file
1
tools/apollo/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.cppcheck_errors
|
16
tools/apollo/cppcheck
Executable file
16
tools/apollo/cppcheck
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd "$DIR/../../"
|
||||
|
||||
errfile="$DIR/.cppcheck_errors"
|
||||
|
||||
files=$( git diff --name-only HEAD~1 HEAD | egrep '^(src|tests|poc)' | egrep '.(hpp|h|cpp)$' )
|
||||
cppcheck --enable=all --force --suppress=missingInclude -Isrc $files 2>"$errfile"
|
||||
|
||||
cat "$errfile" >&2
|
||||
|
||||
len="$( cat "$errfile" | wc -l )"
|
||||
if [ $len -gt 0 ]; then
|
||||
echo -e "Cppcheck errors:\n$( cat "$errfile" )" > "$errfile"
|
||||
fi
|
@ -92,6 +92,16 @@ ARCHIVES.append(generate_archive("Doxygen documentation", "doxygen_documentation
|
||||
|
||||
# TODO: store user documentation to archive
|
||||
|
||||
# cppcheck run
|
||||
cppcheck = os.path.join(BASE_DIR, "tools", "apollo", "cppcheck")
|
||||
check_dirs = list(map(lambda x: os.path.join(BASE_DIR, x), ["src", "tests",
|
||||
"poc", ".git"])) + [cppcheck]
|
||||
archive = create_archive("cppcheck", check_dirs, WORKSPACE_DIR)
|
||||
cmd = os.path.relpath(cppcheck, WORKSPACE_DIR)
|
||||
outfile_paths = "\./" + cmd.replace("cppcheck", ".cppcheck_errors").replace(".", "\\.")
|
||||
RUNS.append(generate_run("cppcheck", commands = './{}'.format(cmd),
|
||||
infile = archive, outfile_paths = outfile_paths))
|
||||
|
||||
# ctest tests
|
||||
ctest_output = run_cmd(["ctest", "-N"], TESTS_DIR)
|
||||
tests = []
|
||||
|
Loading…
Reference in New Issue
Block a user