diff --git a/linux_utils/run_cppcheck.sh b/linux_utils/run_cppcheck.sh new file mode 100644 index 0000000..6d41d6d --- /dev/null +++ b/linux_utils/run_cppcheck.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Función para mostrar el uso del script +mostrar_uso() { + echo "Uso: $0 [-o opción]" + echo "Opciones:" + echo " w Ejecutar cppcheck con warning, style, performance" + echo " a Ejecutar cppcheck con todas las opciones habilitadas" + echo " u Ejecutar cppcheck para unusedFunction" +} + +# Inicializar las variables +opcion="" + +# Procesar las opciones +while getopts "o:" opt; do + case $opt in + o) + opcion=$OPTARG + ;; + *) + mostrar_uso + exit 1 + ;; + esac +done + +# Ejecutar según la opción seleccionada +case $opcion in + w) + cppcheck --force --enable=warning,style,performance --std=c++20 \ + --suppressions-list=./cppcheck_suppressions \ + ../source/ \ + 2>./cppcheck-result-warning-style-performance.txt + ;; + a) + cppcheck --force --enable=all -I /usr/include --std=c++20 \ + --suppress=missingIncludeSystem \ + --suppressions-list=./cppcheck_suppressions \ + ../source/ \ + 2>./cppcheck-result-all.txt + ;; + u) + cppcheck --enable=style --std=c++20 \ + --suppressions-list=./cppcheck_suppressions \ + ../source/ \ + 2>./cppcheck-result-unusedFunction.txt + ;; + *) + mostrar_uso + exit 1 + ;; +esac