Skip to content

Commit

Permalink
Prepare Detekt 1.20.0-RC1 (#4597)
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Feb 28, 2022
1 parent f99cbff commit 9f18b6b
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build-logic/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object Versions {

const val DETEKT: String = "1.19.0"
const val DETEKT: String = "1.20.0-RC1"
const val SNAPSHOT_NAME: String = "main"
const val JVM_TARGET: String = "1.8"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class GenerateConfigTaskSpec {
@ParameterizedTest(name = "Using {0}, can be executed without any configuration")
@MethodSource("io.gitlab.arturbosch.detekt.testkit.DslTestBuilder#builders")
fun emptyConfig(builder: DslTestBuilder) {
val gradleRunner = builder.build()
val gradleRunner = builder.withConfigFile("config/detekt/detekt.yml").build()

gradleRunner.runTasksAndCheckResult("detektGenerateConfig") { result ->
assertThat(result.task(":detektGenerateConfig")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
Expand All @@ -28,7 +28,8 @@ class GenerateConfigTaskSpec {
| config = files("config/detekt/detekt.yml", "config/other/detekt.yml")
|}
"""
).build()
).withConfigFile("config/detekt/detekt.yml").build()
gradleRunner.writeProjectFile("config/other/detekt.yml", content = "")

gradleRunner.runTasksAndCheckResult("detektGenerateConfig") { result ->
assertThat(result.task(":detektGenerateConfig")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class JvmSpec {
.withArguments("detektMain")
.buildAndFail()

assertThat(result.output).contains("Build failed with 2 weighted issues.")
assertThat(result.output).contains("ExitOutsideMain - [kotlinExit]")
assertThat(result.output).contains("ExitOutsideMain - [javaExit]")
assertThat(result.output).contains("failed with 2 weighted issues.")
assertThat(result.output).contains("Do not directly exit the process outside the `main` function. Throw an exception(…)")
assertThat(result.output).contains("Errors.kt:7:9")
assertThat(result.output).contains("Errors.kt:12:16")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ plugins {

repositories {
mavenCentral()
mavenLocal()
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ internal class DefaultCliInvoker(
runner::class.java.getMethod("execute").invoke(runner)
} catch (reflectionWrapper: InvocationTargetException) {
val message = reflectionWrapper.targetException.message
if (message != null && isBuildFailure(message) && ignoreFailures) {
if (message != null && isAnalysisFailure(message) && ignoreFailures) {
return
}
throw GradleException(message ?: "There was a problem running detekt.", reflectionWrapper)
}
}

private fun isBuildFailure(msg: String) = "Build failed with" in msg && "issues" in msg
private fun isAnalysisFailure(msg: String) = "Analysis failed with" in msg && "issues" in msg
}

private class DryRunInvoker(private val logger: Logger) : DetektInvoker {
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ description: "Meet detekt, a static code analysis tool for Kotlin."
url: https://detekt.dev
baseurl: ""

detekt_version: 1.19.0
detekt_version: 1.20.0-RC1
130 changes: 128 additions & 2 deletions docs/pages/changelog 1.x.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,135 @@ permalink: changelog.html
toc: true
---

#### UNRELEASED
#### 1.20.0-RC1 - 2022-02-26

- Now the rule authors can define the default configuration for their rules. More information [here](LINK_PENDIING!!). [#4315](https://github.com/detekt/detekt/pull/4315)
##### Notable Changes

- Thanks to our sponsors ❤️, we were able to buy a domain and move our website to [https://detekt.dev/](https://detekt.dev/).
- With this Detekt versions, rule authors **can define the default configuration** for their custom rules. This default configuration will be merged together with the user configuration and can be overridden by the user if they wish. More on this here [#4315](https://github.com/detekt/detekt/pull/4315). The `formatting` ruleset provided by Detekt is updated to use this new mechanism - [#4352](https://github.com/detekt/detekt/pull/4352)
- We've added **4 new rules**:
- UnnecessaryInnerClass - [#4394](https://github.com/detekt/detekt/pull/4394)
- CanBeNonNullableProperty - [#4379](https://github.com/detekt/detekt/pull/4379)
- TrailingComma - [#4227](https://github.com/detekt/detekt/pull/4227)
- NullCheckOnMutableProperty - [#4353](https://github.com/detekt/detekt/pull/4353)
- We've made several improvements to the **console reporting**:
- The HTML report has now a better CSS styling - [#4447](https://github.com/detekt/detekt/pull/4447)
- The default reporting format is now `LiteFindingsReport` (which is more compact reporting and similar to other tools in the ecosystem. [You can see an example here](https://github.com/detekt/detekt/pull/4027)) - [#4449](https://github.com/detekt/detekt/pull/4449).
- We've added issue details to findings on `FindingsReport` and `FileBasedFindingsReporter` - [#4464](https://github.com/detekt/detekt/pull/4464)
- We suppressed several warnings reported when running with type resolution - [#4423](https://github.com/detekt/detekt/pull/4423)
- We fixed a **regression** introduced in `1.19.0` for users using `ignoreAnnotated` running **without type resolution** - [#4570](https://github.com/detekt/detekt/pull/4570)
- We've fixed a security vulnerability related to XML parsing - [#4499](https://github.com/detekt/detekt/pull/4499)
- We've changed the behavior of the baseline task. Now the baseline is always update, even if you fixed all the issues in your codebase - [#4445](https://github.com/detekt/detekt/pull/4445)
- We now enable the naming ruleset by default also on tests. Previously they were excluded - [#4438](https://github.com/detekt/detekt/pull/4438)
- This version of Detekt is built with Gradle `v7.4`, AGP `7.1.1` and Kotlin `1.6.10` (see [#4530](https://github.com/detekt/detekt/pull/4530) [#4573](https://github.com/detekt/detekt/pull/4573) [#4133](https://github.com/detekt/detekt/pull/4133) [#4277](https://github.com/detekt/detekt/pull/4277))
- This version of Detekt is wrapping KtLint version `0.43.2` (see [#4227](https://github.com/detekt/detekt/pull/4227))
- For contributors: we migrated most of our tests **from Spek to JUnit** due to better support and tooling.

##### Changelog

- Better error classification in Gradle Enterprise. - [#4586](https://github.com/detekt/detekt/pull/4586)
- Fix for missing /kotlin folder when running on Android projects - [#4554](https://github.com/detekt/detekt/pull/4554)
- Deprecate continuationIndentSize from the Indentation rule - [#4551](https://github.com/detekt/detekt/pull/4551)
- Fix performance issue for regexp in Reporting.kt - [#4550](https://github.com/detekt/detekt/pull/4550)
- Revert "trim values when parsing the baseline (#4335)" - [#4548](https://github.com/detekt/detekt/pull/4548)
- Fix AutoCorrection crashing with Missing extension point - [#4545](https://github.com/detekt/detekt/pull/4545)
- Make DoubleMutabilityForCollection configurable and set a DoubleMutability alias - [#4541](https://github.com/detekt/detekt/pull/4541)
- Fix `AnnotationExcluder` - [#4518](https://github.com/detekt/detekt/pull/4518)
- Fix false positive of UnnecessaryInnerClass - [#4509](https://github.com/detekt/detekt/pull/4509)
- [MaxLineLength] Fix signature in for blank characters in the Baseline - [#4504](https://github.com/detekt/detekt/pull/4504)
- Fix overridden function reporting for CanBeNonNullable rule - [#4497](https://github.com/detekt/detekt/pull/4497)
- Set the name of functions and paramenters between ` to improve the readability - [#4488](https://github.com/detekt/detekt/pull/4488)
- update InvalidPackageDeclaration to report if rootPackage is not present - [#4484](https://github.com/detekt/detekt/pull/4484)
- [VarCouldBeVal] Override vars will not be flagged if bindingContext is not set - [#4477](https://github.com/detekt/detekt/pull/4477)
- Document the overlapping rules from `formatting` - [#4473](https://github.com/detekt/detekt/pull/4473)
- Match functions signatures with lambdas on it - [#4458](https://github.com/detekt/detekt/pull/4458)
- Add option for OutdatedDocumentation to allow param in constructor pr… - [#4453](https://github.com/detekt/detekt/pull/4453)
- Ignore private operators when we don't have ContextBingding in UnusedPrivateMember - [#4441](https://github.com/detekt/detekt/pull/4441)
- Add documentation for `Suppressor`s - [#4440](https://github.com/detekt/detekt/issues/4440)
- [FunctionNaming] Don't allow the usage of ` in function names - [#4439](https://github.com/detekt/detekt/pull/4439)
- Add list of functions to skip in IgnoredReturnValue rule - [#4434](https://github.com/detekt/detekt/pull/4434)
- Extend CanBeNonNullable rule to check function params - [#4431](https://github.com/detekt/detekt/pull/4431)
- Extend VarCouldBeVal to include analysis of file- and class-level properties - [#4424](https://github.com/detekt/detekt/pull/4424)
- Formulate rule/sample-extensions descriptions consistently - [#4412](https://github.com/detekt/detekt/pull/4412)
- Fix false-positive on ExplicitCollectionElementAccessMethod - [#4400](https://github.com/detekt/detekt/pull/4400)
- Fixes false negatives in `UnnecessaryAbstractClass` - [#4399](https://github.com/detekt/detekt/pull/4399)
- Add first draft of a rule description style guide - [#4386](https://github.com/detekt/detekt/pull/4386)
- Forbid usage of java.lang.ClassLoader.getResourceAsStream - [#4381](https://github.com/detekt/detekt/pull/4381)
- Update Sponsor button to Detekt's one - [#4378](https://github.com/detekt/detekt/pull/4378)
- [OptionalUnit] Allow a function to declare a Unit return type when it uses a generic function initializer - [#4371](https://github.com/detekt/detekt/pull/4371)
- Completely-empty abstract classes will now be flagged by UnnecessaryAbstractClass - [#4370](https://github.com/detekt/detekt/pull/4370)
- Fix false positive in RethrowCaughtException for try with more than one catch (#4367) - [#4369](https://github.com/detekt/detekt/pull/4369)
- Testing and rule improvement for EmptyElseBlock - [#4349](https://github.com/detekt/detekt/pull/4349)
- UnusedPrivateMember should not report external classes/interfaces - [#4347](https://github.com/detekt/detekt/pull/4347)
- [UseDataClass] Do not report on `inner` classes - [#4344](https://github.com/detekt/detekt/pull/4344)
- Support jvmTarget 17 - [#4287](https://github.com/detekt/detekt/issues/4287)
- UnderscoresInNumericLiterals: Allow numbers with non standard groupings - [#4280](https://github.com/detekt/detekt/pull/4280)
- Introduce DefaultValue type - [#3928](https://github.com/detekt/detekt/pull/3928)

##### Dependency Updates

- Update dependency com.android.tools.build:gradle to v7.1.2 - [#4594](https://github.com/detekt/detekt/pull/4594)
- Update dependency com.android.tools.build:gradle to v7.1.1 - [#4561](https://github.com/detekt/detekt/pull/4561)
- Update plugin pluginPublishing to v0.20.0 - [#4502](https://github.com/detekt/detekt/pull/4502)
- Update JamesIves/github-pages-deploy-action action to v4.2.1 - [#4475](https://github.com/detekt/detekt/pull/4475)
- Update JamesIves/github-pages-deploy-action action to v4.1.9 - [#4455](https://github.com/detekt/detekt/pull/4455)
- Update plugin gradleVersions to v0.41.0 - [#4454](https://github.com/detekt/detekt/pull/4454)
- Revert "Update plugin pluginPublishing to v0.19.0 (#4429)" - [#4452](https://github.com/detekt/detekt/pull/4452)
- Update plugin pluginPublishing to v0.19.0 - [#4429](https://github.com/detekt/detekt/pull/4429)
- Update dependency io.mockk:mockk to v1.12.2 - [#4427](https://github.com/detekt/detekt/pull/4427)
- Shadow 7.1.2 - [#4422](https://github.com/detekt/detekt/pull/4422)
- Update plugin dokka to v1.6.10 - autoclosed - [#4407](https://github.com/detekt/detekt/pull/4407)
- Update dependency org.jetbrains.dokka:jekyll-plugin to v1.6.10 - [#4406](https://github.com/detekt/detekt/pull/4406)
- Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.0 - [#4393](https://github.com/detekt/detekt/pull/4393)
- Update dependency gradle to v7.3.3 - [#4392](https://github.com/detekt/detekt/pull/4392)
- Update dependency org.yaml:snakeyaml to v1.30 - [#4375](https://github.com/detekt/detekt/pull/4375)
- Update dependency gradle to v7.3.2 - [#4374](https://github.com/detekt/detekt/pull/4374)
- Update plugin shadow to v7.1.1 - [#4373](https://github.com/detekt/detekt/pull/4373)
- Update dependency gradle to v7.3.1 - [#4350](https://github.com/detekt/detekt/pull/4350)
- Update plugin dokka to v1.6.0 - [#4328](https://github.com/detekt/detekt/pull/4328)

##### Housekeeping & Refactorings

- Housekeep Gradle scripts - [#4589](https://github.com/detekt/detekt/pull/4589)
- Refactor config printer to improve testability - [#4580](https://github.com/detekt/detekt/pull/4580)
- avoid usage of java stream for parameterized tests - [#4579](https://github.com/detekt/detekt/pull/4579)
- split rule documentation printer to improve testability - [#4578](https://github.com/detekt/detekt/pull/4578)
- Make VERSION_CATALOGS stable - [#4577](https://github.com/detekt/detekt/pull/4577)
- Enable Gradle's configuration cache by default - [#4576](https://github.com/detekt/detekt/pull/4576)
- Migrate detekt-rules-performance tests to JUnit - [#4569](https://github.com/detekt/detekt/pull/4569)
- Migrate detekt-rules-complexity tests to JUnit - [#4566](https://github.com/detekt/detekt/pull/4566)
- Drop Groovy DSL testing in DetektTaskDslSpec - [#4563](https://github.com/detekt/detekt/pull/4563)
- Reuse `setReportOutputConventions` - [#4546](https://github.com/detekt/detekt/pull/4546)
- Code cleanups - [#4542](https://github.com/detekt/detekt/pull/4542)
- Fix MaxLineLength violation on detekt main inside IgnoredReturnValue rule - [#4539](https://github.com/detekt/detekt/pull/4539)
- Use Java 17 for all CI jobs - [#4526](https://github.com/detekt/detekt/pull/4526)
- Migrate tests in detekt-rules-errorprone to junit - [#4523](https://github.com/detekt/detekt/pull/4523)
- Drop unused dependencies - [#4506](https://github.com/detekt/detekt/pull/4506)
- Update JUnit dependencies - [#4505](https://github.com/detekt/detekt/pull/4505)
- Fixes test for LiteFindingsReport - [#4479](https://github.com/detekt/detekt/pull/4479)
- Remove outdated detekt suppression - [#4468](https://github.com/detekt/detekt/pull/4468)
- Add test cases to RedundantSuspendModifier rule - [#4430](https://github.com/detekt/detekt/pull/4430)
- Refactor MultilineLambdaItParameter rule - [#4428](https://github.com/detekt/detekt/pull/4428)
- Formulate rule/naming descriptions consistently - [#4419](https://github.com/detekt/detekt/pull/4419)
- Formulate rule/bugs descriptions consistently - [#4418](https://github.com/detekt/detekt/pull/4418)
- Formulate rule/complexity descriptions consistently - [#4417](https://github.com/detekt/detekt/pull/4417)
- Formulate rule/documentation descriptions consistently - [#4416](https://github.com/detekt/detekt/pull/4416)
- Formulate rule/coroutines descriptions consistently - [#4415](https://github.com/detekt/detekt/pull/4415)
- Formulate rule/style descriptions consistently - [#4414](https://github.com/detekt/detekt/pull/4414)
- Formulate rule/exceptions descriptions consistently - [#4413](https://github.com/detekt/detekt/pull/4413)
- Formulate rule/performance descriptions consistently - [#4411](https://github.com/detekt/detekt/pull/4411)
- Make MultiRuleCollector.kt consistent with the DoubleMutabilityForCollection rule - [#4405](https://github.com/detekt/detekt/pull/4405)
- Add test for nested SwallowedException - [#4404](https://github.com/detekt/detekt/pull/4404)
- Disable CI for Windows & JDK8 - [#4403](https://github.com/detekt/detekt/pull/4403)
- Improve test description in ForEachOnRangeSpec.kt - [#4402](https://github.com/detekt/detekt/pull/4402)
- Don't define classes on default package - [#4401](https://github.com/detekt/detekt/pull/4401)
- Config file in directory test - [#4398](https://github.com/detekt/detekt/pull/4398)
- Remove unnecessary map lambda in test code - [#4397](https://github.com/detekt/detekt/pull/4397)
- Improve `AnnotationExcluder` tests - [#4368](https://github.com/detekt/detekt/pull/4368)
- Enable UseAnyOrNoneInsteadOfFind - [#4362](https://github.com/detekt/detekt/pull/4362)
- Enable ForbiddenMethodCall - [#4334](https://github.com/detekt/detekt/pull/4334)

See all issues at: [1.20.0](https://github.com/detekt/detekt/milestone/85)

#### 1.19.0 - 2021-11-29

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jcommander = "com.beust:jcommander:1.82"

[plugins]
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.8.0" }
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.19.0" }
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.20.0-RC1" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
gradleVersions = { id = "com.github.ben-manes.versions", version = "0.42.0" }
pluginPublishing = { id = "com.gradle.plugin-publish", version = "0.20.0" }
Expand Down

0 comments on commit 9f18b6b

Please sign in to comment.