fix empty files
This commit is contained in:
parent
a6eb7b8056
commit
1f232b65e1
1 changed files with 11 additions and 9 deletions
|
@ -63,7 +63,7 @@ find_source_files() {
|
||||||
|
|
||||||
if [[ "${CHECK_MODIFIED}" == true ]]; then
|
if [[ "${CHECK_MODIFIED}" == true ]]; then
|
||||||
# Fichiers modifiés uniquement
|
# Fichiers modifiés uniquement
|
||||||
mapfile -t files < <(git diff --name-only --diff-filter=ACMR HEAD -- $(printf "%s " "${TARGET_DIRS[@]}") | grep -E '\.(h|cpp|hpp|c)$')
|
mapfile -t files < <(git diff --name-only --diff-filter=ACMR HEAD -- $(printf "%s " "${TARGET_DIRS[@]}") | awk 'length($0) && /\.(h|cpp|hpp|c)$/' | grep -v '^$')
|
||||||
else
|
else
|
||||||
# Tous les fichiers
|
# Tous les fichiers
|
||||||
for dir in "${TARGET_DIRS[@]}"; do
|
for dir in "${TARGET_DIRS[@]}"; do
|
||||||
|
@ -109,14 +109,16 @@ main() {
|
||||||
${VERBOSE} && echo "🛠️ Application du formatage"
|
${VERBOSE} && echo "🛠️ Application du formatage"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in "${files[@]}"; do
|
for file in "${files[@]}"; do
|
||||||
|
# Si la ligne est vide, passe au suivant
|
||||||
|
[[ -z "$file" ]] && continue
|
||||||
${VERBOSE} && echo "🔎 Traitement : ${file}"
|
${VERBOSE} && echo "🔎 Traitement : ${file}"
|
||||||
|
|
||||||
if ! "${CLANG_FORMAT_BIN}" "${format_args[@]}" "${file}"; then
|
if ! "${CLANG_FORMAT_BIN}" "${format_args[@]}" "${file}"; then
|
||||||
((errors++))
|
((errors++))
|
||||||
${DRY_RUN} && echo "❌ Problème détecté : ${file}"
|
${DRY_RUN} && echo "❌ Problème détecté : ${file}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${errors} -gt 0 ]]; then
|
if [[ ${errors} -gt 0 ]]; then
|
||||||
echo -e "\n❌ ${errors} fichier(s) nécessitent un formatage"
|
echo -e "\n❌ ${errors} fichier(s) nécessitent un formatage"
|
||||||
|
|
Loading…
Reference in a new issue