Files
Amber/git-hooks/pre-commit
greenart7c3 77cee97725 Fail the build on compiler warnings and unused code
Kotlin warnings are now errors, and a detektAll task checks the app
(every flavor, unit and instrumented tests) and desktop for unused
imports, parameters, variables and private declarations, with type
resolution. Both run in the pre-commit hook and CI.

Fix what they found: deprecated Quartz event types (ZapRequestEvent,
SealEvent), Compose Desktop's deprecated clipboard, painterResource and
tab indicator APIs, unused parameters, imports and variables, needless
safe calls, and test code that no longer compiled cleanly. Deliberate
cases, such as the OkHttp body null checks the offline flavor needs, are
suppressed where they occur.
2026-10-25 19:38:24 -03:00

26 lines
902 B
Bash

#!/bin/bash
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
echo "*********************************************************"
echo "Running git pre-commit hook. Running Static analysis and Android Lint... "
echo "*********************************************************"
./gradlew ktlintCheck detektAll lint
status=$?
if [ "$status" = 0 ] ; then
echo "Static analysis found no problems."
exit 0
else
echo "*********************************************************"
echo 1>&2 "Static analysis found violations it could not fix."
printf "Run ${GREEN}./gradlew ktlintFormat${NO_COLOR} to fix formatting related issues...\n"
printf "Run ${GREEN}./gradlew detektAll${NO_COLOR} to see unused code...\n"
printf "Run ${GREEN}./gradlew lint${NO_COLOR} and open the report to see Android Lint issues...\n"
echo "*********************************************************"
exit 1
fi