lib/ios/hooks/pre-commit in shellboxCLI-0.3.1 vs lib/ios/hooks/pre-commit in shellboxCLI-0.3.2

- old
+ new

@@ -14,17 +14,20 @@ # Verifica se existem arquivos Swift para lint if [ -n "$files" ]; then echo "Executando Swiftlint nos arquivos alterados..." - # Executa o Swiftlint nos arquivos em diff - lint_output=$($SWIFTLINT_PATH lint --path $files) + lint_output=$($SWIFTLINT_PATH lint $files) - if [ -n "$lint_output" ]; then - echo "Erros ou avisos do Swiftlint encontrados:" - echo "$lint_output" + lint_errors=$(echo "$lint_output" | grep "error:") + if [ -n "$lint_errors" ]; then + echo "Erros do Swiftlint encontrados:" + echo "$lint_errors" echo "Corrija os problemas de lint antes de commitar." exit 1 + else + echo "Swiftlint warnings:" + echo "$lint_output" fi fi -exit 0 \ No newline at end of file +exit 0