1
0
mirror of https://github.com/nisrulz/flutter-examples.git synced 2026-08-25 09:13:00 +00:00
Files
flutter-examples/scripts/analyze_all.sh
Nishant Srivastava 2cf50c0b6b tools: add make analyze/test/doctor and unify gradle wrappers
- Add scripts/analyze_all.sh and scripts/test_all.sh that run flutter
  analyze/test across every app and report a summary
- Add scripts/repo_doctor.sh that flags config drift (sdk constraint,
  analysis_options, pubspec name, applicationId, gradle version, docs,
  tracked generated files) and exits non-zero for use as a pre-commit gate
- Wire these into the Makefile as 'make analyze/test/doctor' and document
  them in MAINTENANCE.md
- Bring bmi_calculator and push_notifications gradle wrappers up to the
  repo-standard 9.7.0; note push_notifications as a Firebase app requiring
  google-services.json
2026-08-17 23:48:02 +02:00

49 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Runs `flutter analyze` in every example app and reports the results.
# Exits non-zero if any app has analyzer issues.
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
clean=0
issues=0
failed=0
apps_with_issues=()
analyze_app() {
local dir="$1"
local app
app=$(basename "$dir")
local out
if ! out=$(cd "$dir" && flutter analyze 2>&1); then
failed=$((failed + 1))
return
fi
local summary
summary=$(echo "$out" | tail -1)
if echo "$out" | grep -q "No issues found"; then
clean=$((clean + 1))
else
issues=$((issues + 1))
apps_with_issues+=("$app")
printf " %-30s %s\n" "$app" "$summary"
fi
}
separator
echo " Running flutter analyze for all Flutter apps:"
for_each_app pubspec.yaml analyze_app
separator
printf " %-16s %s\n" "Clean:" "$clean"
printf " %-16s %s\n" "With issues:" "$issues"
printf " %-16s %s\n" "Failed to run:" "$failed"
if [ "${#apps_with_issues[@]}" -gt 0 ]; then
echo " Apps with issues:"
printf " %s\n" "${apps_with_issues[@]}"
fi
separator
[ "$issues" -eq 0 ] && [ "$failed" -eq 0 ]