This project contains Detekt rules for the Arrow ecosystem.
- Add this project as a Detekt plugin to
build.gradle.kts
dependencies {
detektPlugins("com.wolt.arrow.detekt:rules:*VERSION*")
}
- Enable and configure rules in Detekt configuration, example:
ArrowRuleSet:
NoEffectScopeBindableValueAsStatement:
active: true
Note that by default Detekt runs without type resolution enabled (just running detekt
will not run the rules from this repo), see Detekt documentation on that.
- Read Detekt documentation about extending it.
- When adding a new rule, don't forget to include it RuleSetProvider (or create one if adding a new rule set).
- Note that rules are disabled by default, enable them in the Detekt configuration.
- Draft a new release on GitHub.
- Create a new tag (e.g.
v0.1.1
if the previous wasv0.1.0
and you want to bump the patch version). - Auto-generate release notes.
- Publish the release.
- This will trigger a CI workflow to build and publish the library to Sonatype Nexus. You can see it here. After publishing succeeds, login to Sonatype Nexus and select "Staging repositories".
- Check the content of the new entry.
- If there are no issues, press "Close". It will run the checks required for sync with Maven Central. If there are issues, press "Drop".
- Press "Release" to sync with Maven Central (Or "Drop" if there are problems with content/checks).
This rule reports any bindable value from Arrow-kt (like Either) that is used as an unbound statement inside scope that allows binding values.
Active by default: No
Requires Type Resolution
Noncompliant code:
fun doSomething() = Either.Left(Throwable("Oh no"))
fun doSomethingElse() = Either.Right(5)
return either {
doSomething()
doSomethingElse().bind()
}
Compliant code:
fun doSomething() = Either.Left(Throwable("Oh no"))
fun doSomethingElse() = Either.Right(5)
return either {
doSomething().bind()
doSomethingElse().bind()
}