variables:
  RUN_FLAWFINDER: "flawfinder --falsepositive -m 4"
  RUN_CPPCHECK: "cppcheck --enable=all --error-exitcode=1 --suppress=unusedFunction --suppress=unreadVariable --suppress=unmatchedSuppression ."
  RUN_CPD: "/home/user/pmd-bin-6.19.0/bin/run.sh cpd --minimum-tokens 200 --language c --exclude ./test/cmocka --files"
  SOURCE_FOLDER: "src"
  COMMON_IMAGE: "iopsys/code-analysis:0.27"
  DEBUG: "FALSE"

run_static_code_analysis:
  image: ${COMMON_IMAGE}
  stage: static_code_analysis
  allow_failure: false
  script:
    - echo ${RUN_FLAWFINDER}
    - flawfinder --version
    - "${RUN_FLAWFINDER} ${SOURCE_FOLDER}"
    - echo ${RUN_CPPCHECK}
    - cppcheck --version
    - "${RUN_CPPCHECK} ${SOURCE_FOLDER}"
    - echo ${RUN_CPD}
    - "${RUN_CPD} ${SOURCE_FOLDER}"
