From c89250698116180acfe9a98c24e2e5291e050240 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 19:40:45 +0000 Subject: gradle-report: a missing report is a failure, not a pass The lint path was wrong -- AGP writes to app/build/reports/, not app/build/ -- and the script fell back to the gradle exit code, printing 'report: MISSING ... result: PASS'. A checker that cannot find what it is meant to check and passes anyway is precisely the failure these wrappers exist to prevent, and it hid real lint errors in Listen for one run. Now locates the report rather than assuming a path, and a missing report fails while saying the check did not actually inspect anything. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B --- bin/gradle-report | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/gradle-report b/bin/gradle-report index bbee2b7..cc0de03 100755 --- a/bin/gradle-report +++ b/bin/gradle-report @@ -25,7 +25,11 @@ EXTRA=("$@") case "$KIND" in detekt) TASK=":app:detekt"; REPORT="$PROJECT_DIR/app/build/reports/detekt/detekt.xml" ;; - lint) TASK=":app:lintDebug"; REPORT="$PROJECT_DIR/app/build/lint-results-debug.xml" ;; + # AGP has moved this file between versions, so locate it rather than assuming. A hardcoded + # path that stops resolving turns into "MISSING ... PASS", which is worse than no check. + lint) TASK=":app:lintDebug" + REPORT=$(find "$PROJECT_DIR/app/build" -name "lint-results-debug.xml" 2>/dev/null | head -1) + REPORT=${REPORT:-$PROJECT_DIR/app/build/reports/lint-results-debug.xml} ;; *) die "kind must be 'detekt' or 'lint', got '$KIND'" ;; esac @@ -58,10 +62,13 @@ if grep -qiE "is misspelled or does not exist|configuration file is invalid|inva fi if [ ! -f "$REPORT" ]; then + # Falling back to the exit code here is how a broken path becomes a silent pass. Say that + # the check did not actually happen. echo "report : MISSING ($REPORT)" - echo "result : $([ $STATUS -eq 0 ] && echo 'PASS (no report produced, nothing to read)' || echo 'FAIL')" + echo "hint : the report path may have moved; this check did NOT inspect any findings" + echo "result : FAIL — no report to read (gradle exit $STATUS)" rm -f "$LOG" - exit $STATUS + exit 1 fi if [ "$REPORT" -ot "$MARKER" ] && [ $ALLOW_STALE -eq 0 ]; then -- cgit v1.2.3