https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: ee7a1f9604f4d84b0d8038b4b9412575a5da98c3 authored by Lars Bilke on 01 April 2021, 10:56:29 UTC
Merge branch 'single-poetry-add' into 'master'
Tip revision: ee7a1f9
cppcheck.in.sh
# Runs cppcheck with GitLab CI (CodeClimate) output
OUTPUT_FILE=${PROJECT_BINARY_DIR}/cppcheck.json
${CPPCHECK_TOOL_PATH} \
        --project=${PROJECT_BINARY_DIR}/compile_commands.json \
        --language=c++ \
        --std=c++20 \
        --enable=all \
        --inconclusive \
        -j ${CPPCHECK_PARALLEL} \
        --suppress=*:*/usr/local\* \
        --suppress=*:*cpm\* \
        --suppress=*:*Tests\* \
        --template='{\n  "description": "{message}",\n  "severity": "info",\n    "location": {\n    "path": "{file}",\n    "lines": {\n      "begin": {line}\n    }\n  }\n},' \
        --output-file=$OUTPUT_FILE \

echo "$( \
  # add brackets
  printf '[\n'; \
  cat $OUTPUT_FILE | \
  # strip source code absolute path
  sed 's|${PROJECT_SOURCE_DIR}/||' | \
  # escape strings
  sed 's/string literal "\(.*\)" to/string literal \\"\1\\" to/g' | \
  # remove last comma
  sed '$s/,$//'; \
  printf ']\n')" \
  > $OUTPUT_FILE

if [ -f ${Python3_EXECUTABLE} ]; then
    ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/test/cppcheck_gen_hashes.py $OUTPUT_FILE
fi
back to top