Closed leandroBorgesFerreira closed 5 years ago
@cavega @wokkaflokka perhaps you would like to take a look.
Build is currently failing due to lint
> Task :app:lint
Calling mockable JAR artifact transform to create file: /home/travis/.gradle/caches/transforms-1/files-1.1/android.jar/a43d44feb3e2df5735e4510375c025bb/android.jar with input /usr/local/android-sdk/platforms/android-28/android.jar
Ran lint on variant debug: 41 issues found
Ran lint on variant release: 41 issues found
Wrote HTML report to file:///home/travis/build/leandroBorgesFerreira/LoadingButtonAndroid/app/build/reports/lint-results.html
Wrote XML report to file:///home/travis/build/leandroBorgesFerreira/LoadingButtonAndroid/app/build/reports/lint-results.xml
> Task :app:lintKotlinAndroidTest FAILED
Lint error > src/androidTest/java/br/com/simplepass/loadingbutton/CircularProgressButtonTest.kt:31:5: Missing space after //
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintKotlinAndroidTest'.
> Kotlin source failed lint check.
I ran into Kotlin Liny errors with my PR. Can we add a pre-commit hook so lintKotlin task runs on each commit?
@cavega I'm not sure if I follow. The link already runs in every commit of the PR.
@leandroBorgesFerreira It runs on remote. The pre-commit hook will run lintKotlin in the dev machine. That way the developer doesn't have to wait until the remote build flags an error and instead he can get alerted right when doing the commit. This also removes the mental note "let me run lintKotlin before submmit my PR". Its a convenience not a necessity.
In the mean time, is lintKotlin configurable where waivers can be added. Right now Android Studio Kotlin code style (forcing wild car import) is in conflict with lintKotlin that ones each import to be explicit.
A pre-commit hook inside .git/hooks
, right? I never used then before. I just tested and it works nicely, but they live inside .git
directory and this is never committed. Is your idea to put it inside someplace in the project so the developer can configure it in its own machine?
@leandroBorgesFerreira Yeah, you can't completely put it in revision control. The way I've done on some other projects is by having a script directory under revision control (i.e. root dir) which contains a file with the actual pre-commit hook logic. Then in README.md I optionally suggest developers to use it by doing a symlink such as:
cd .git/hooks
ln -s <relative_path_to_script_file/pre-commit.sh> .pre-commit
Developers that rarely contribute to the project can safely ignore this (remote build will run lintKotlin, etc) but developers that contribute and commit frequently can take advantage of setting the symlink so that they can quickly catch lint errors on each commit.
It looks good. Would you like to work on that? I am opening an issue for it
Improving integration tests