From 145d1e3fc0585a9635c2aee867393688450a3d20 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 24 Oct 2025 17:58:53 +0200 Subject: [PATCH] canvis en run_clang-tidy.sh --- linux_utils/run_clang-tidy.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/linux_utils/run_clang-tidy.sh b/linux_utils/run_clang-tidy.sh index 7ec390a..233ab9f 100755 --- a/linux_utils/run_clang-tidy.sh +++ b/linux_utils/run_clang-tidy.sh @@ -1,7 +1,18 @@ #!/bin/bash # Script para ejecutar clang-tidy en múltiples directorios -# Uso: ./run_clang-tidy.sh +# Uso: ./run_clang-tidy.sh [--fix] +# --fix: Aplica las correcciones automáticamente (opcional) + +# Detectar si se pasó el parámetro --fix +FIX_FLAG="" +if [[ "$1" == "--fix" ]]; then + FIX_FLAG="--fix" + echo "Modo: Aplicando correcciones automáticamente (--fix)" +else + echo "Modo: Solo análisis (sin --fix)" +fi +echo # Lista de rutas donde ejecutar clang-tidy PATHS=( @@ -31,8 +42,8 @@ process_directory() { cd "$dir" || return 1 # Buscar archivos .cpp, .h, .hpp solo en el nivel actual (no subdirectorios) - find . -maxdepth 1 \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) | \ - xargs -P4 -I{} bash -c 'echo "Procesando: {}"; clang-tidy {} -p '"$BUILD_DIR"' --fix' + find . -maxdepth 1 \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) -print0 | \ + xargs -0 -P4 -I{} bash -c 'echo "Procesando: {}"; clang-tidy {} -p '"$BUILD_DIR"' '"$FIX_FLAG" echo "=== Completado: $dir ===" echo