diff options
| author | Claude <noreply@anthropic.com> | 2026-09-21 19:18:56 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-09-21 19:18:56 +0000 |
| commit | 95f95acdb551168f2e5a52e000ff62167be266a8 (patch) | |
| tree | eb36f1d9fab024f223a988e1815012c1a2a18e35 /test/run-tests.sh | |
| parent | 8f94e3caa0b1b477bacbbbd8954f2cea743a9337 (diff) | |
gradle-report: name UP-TO-DATE as the cause of a stale report
Found by running it: detekt exited 0 while the report predated the run,
because Gradle skipped the task. 'STALE' alone leaves the reader to work out
why nothing changed, so it now says which task was skipped and how to force
it, with --allow-stale to accept an older report deliberately. Same shape as
gradle-test, which learned this first.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
Diffstat (limited to 'test/run-tests.sh')
| -rwxr-xr-x | test/run-tests.sh | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/run-tests.sh b/test/run-tests.sh index 6e8ae43..a88e024 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -195,7 +195,27 @@ else bad "stale report detection" "rc=$rc out=$out" fi -# 15. A missing project directory is fatal, never a silent fallback to cwd. +# 15. UP-TO-DATE is the common way a report goes stale, so say so rather than leaving the +# reader to work out why nothing changed. +d="$tmproot/report-uptodate" +make_project "$d" 0 'echo "> Task :app:detekt UP-TO-DATE"' +mkdir -p "$d/app/build/reports/detekt" +printf '<?xml version="1.0"?><checkstyle></checkstyle>' > "$d/app/build/reports/detekt/detekt.xml" +touch -d '2020-01-01' "$d/app/build/reports/detekt/detekt.xml" +out=$("$BIN/gradle-report" "$d" detekt 2>&1); rc=$? +if [ $rc -ne 0 ] && printf '%s' "$out" | grep -qi "UP-TO-DATE"; then + ok "explains an UP-TO-DATE task rather than just saying stale" +else + bad "up-to-date hint" "rc=$rc out=$out" +fi +out=$("$BIN/gradle-report" "$d" detekt --allow-stale 2>&1); rc=$? +if [ $rc -eq 0 ] && printf '%s' "$out" | grep -qi "allow-stale"; then + ok "--allow-stale opts in to an older report" +else + bad "allow-stale" "rc=$rc out=$out" +fi + +# 16. A missing project directory is fatal, never a silent fallback to cwd. out=$("$BIN/gradle-report" "$tmproot/nope" detekt 2>&1); rc=$? if [ $rc -eq 2 ]; then ok "missing project dir is fatal"; else bad "missing dir" "rc=$rc"; fi |
