-
Notifications
You must be signed in to change notification settings - Fork 1
Tool Setup
There's a number of peculiarities with Detekt, which initially made it hard to configure. Those issues have been resolved or hacked around.
- Detekt fails on Windows unless the cache directory is set somewhere outside of the project. To work around this, always run Detekt with a relocated cache:
gradlew detektCheck --project-cache-dir=../schaapi-cache
. This extra argument should not be necessary on Unix. Yes, this also means that you will get an annoyingschaapi-cache
directory as a sibling to yourschaapi
repo directory. - Because of the issue above, the
check
task does not rely ondetectCheck
. If you want to run all tests and verification, rungradlew detektCheck --project-cache-dir=../schaapi-cache check
. Again, the extra argument should not be necessary on Unix. - Detekt should be applied only to the root project (in the
build.gradle
, that is), not to the individual subprojects. It is therefore currently not possible to change the configuration of Detekt per module. This also means that you cannot rungradlew :subproject:detectCheck
, but luckilygradlew :detectCheck
already checks all the modules, including the subprojects. - Detekt creates the directories
--config
and--config-config-resource
for some reason. This is a bug. I have configured Gradle to remove these directories after running Detekt. - It doesn't work on Travis for some reason. Luckily, we also have AppVeyor.
ktlint was configured in c47f5d7. The setup uses Spotless, which is a general tool for linters. The reason that Spotless was used is that its Gradle plugin looks way more developed and maintained than ktlint's own (unofficial) plugins.
ktlint enforces the Kotlin style guide. You can configure IntelliJ to conform to this style using the following instructions:
Additionally, you should:
- Disable
Kotlin > Wrapping and Braces > Method call arguments > New line after '('
. - Disable
Kotlin > Wrapping and Braces > Method call arguments > Place ')' on new line
.
ktlint has two tasks: spotlessCheck
and spotlessApply
. The former checks that the code conforms to the required style, and the latter changes the code to conform. The spotlessCheck
is executed as part of gradlew check
, and results in build warnings.
🐑