54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
#!/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
|