mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-30 14:57:34 +00:00
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.
26 lines
902 B
Bash
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
|