mirror of
https://github.com/jlengrand/detekt.git
synced 2026-03-10 08:11:23 +00:00
Prepare 1.10.0 (#2829)
* Prepare 1.10.0 release * Deactivate IsPropertyNaming rule for 1.10.0 release * Update self analysis and doc version
This commit is contained in:
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@@ -89,7 +89,7 @@ Following warning is expected until [Jekyll](https://github.com/jekyll/jekyll/is
|
||||
|
||||
### Release process
|
||||
|
||||
- `groovy scripts/github-milestone-report.groovy` - creates changelog
|
||||
- `./scripts/github-milestone-report.main.kts` - creates changelog
|
||||
- `gradle increment<Patch|Minor|Major>`
|
||||
- `gradle build publishToMavenLocal -x detekt -x test` - publish to local first
|
||||
- `gradle build` - now fully build with tests and self-analysis.
|
||||
|
||||
@@ -14,7 +14,7 @@ repositories {
|
||||
|
||||
object Plugins {
|
||||
const val KOTLIN = "1.3.72"
|
||||
const val DETEKT = "1.10.0-RC1"
|
||||
const val DETEKT = "1.10.0"
|
||||
const val GITHUB_RELEASE = "2.2.12"
|
||||
const val ARTIFACTORY = "4.15.1"
|
||||
const val BINTRAY = "1.8.4"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
object Versions {
|
||||
|
||||
const val DETEKT: String = "1.10.0-RC1"
|
||||
const val DETEKT: String = "1.10.0"
|
||||
const val JVM_TARGET: String = "1.8"
|
||||
const val JACOCO: String = "0.8.5"
|
||||
|
||||
|
||||
@@ -64,8 +64,6 @@ formatting:
|
||||
naming:
|
||||
MemberNameEqualsClassName:
|
||||
active: true
|
||||
IsPropertyNaming:
|
||||
active: false
|
||||
VariableNaming:
|
||||
active: true
|
||||
variablePattern: '[a-z][A-Za-z0-9]*'
|
||||
|
||||
@@ -377,9 +377,6 @@ naming:
|
||||
InvalidPackageDeclaration:
|
||||
active: false
|
||||
rootPackage: ''
|
||||
IsPropertyNaming:
|
||||
active: false
|
||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||
MatchingDeclarationName:
|
||||
active: true
|
||||
mustBeFirst: true
|
||||
|
||||
@@ -27,13 +27,14 @@ import org.jetbrains.kotlin.resolve.typeBinding.createTypeBindingForReturnType
|
||||
* val isEnabled: Boolean = false
|
||||
* </compliant>
|
||||
*/
|
||||
class IsPropertyNaming(config: Config = Config.empty) : Rule(config) {
|
||||
abstract class IsPropertyNaming(config: Config = Config.empty) : Rule(config) {
|
||||
// is abstract to not break providers test - #2819
|
||||
|
||||
private val kotlinBooleanTypeName = "kotlin.Boolean"
|
||||
private val javaBooleanTypeName = "java.lang.Boolean"
|
||||
|
||||
override val issue = Issue(
|
||||
javaClass.simpleName,
|
||||
"IsPropertyNaming", // javaClass.simpleName,
|
||||
Severity.Warning,
|
||||
"Only boolean property names can start with 'is' prefix.",
|
||||
debt = Debt.FIVE_MINS
|
||||
|
||||
@@ -22,7 +22,7 @@ class NamingRules(config: Config = Config.empty) : MultiRule() {
|
||||
private val variableMaxNameLengthRule = VariableMaxLength(config)
|
||||
private val topLevelPropertyRule = TopLevelPropertyNaming(config)
|
||||
private val objectConstantNamingRule = ObjectPropertyNaming(config)
|
||||
private val isPropertyNamingRule = IsPropertyNaming(config)
|
||||
// private val isPropertyNamingRule = IsPropertyNaming(config)
|
||||
private val packageNamingRule = PackageNaming(config)
|
||||
private val classOrObjectNamingRule = ClassNaming(config)
|
||||
private val enumEntryNamingRule = EnumNaming(config)
|
||||
@@ -39,7 +39,7 @@ class NamingRules(config: Config = Config.empty) : MultiRule() {
|
||||
variableMaxNameLengthRule,
|
||||
topLevelPropertyRule,
|
||||
objectConstantNamingRule,
|
||||
isPropertyNamingRule,
|
||||
// isPropertyNamingRule,
|
||||
packageNamingRule,
|
||||
classOrObjectNamingRule,
|
||||
enumEntryNamingRule,
|
||||
@@ -86,7 +86,7 @@ class NamingRules(config: Config = Config.empty) : MultiRule() {
|
||||
private fun handleProperty(declaration: KtProperty) {
|
||||
variableMaxNameLengthRule.runIfActive { visitProperty(declaration) }
|
||||
variableMinNameLengthRule.runIfActive { visitProperty(declaration) }
|
||||
isPropertyNamingRule.runIfActive { visitProperty(declaration) }
|
||||
// isPropertyNamingRule.runIfActive { visitProperty(declaration) }
|
||||
|
||||
when {
|
||||
declaration.isTopLevel -> topLevelPropertyRule.runIfActive { visitProperty(declaration) }
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.spekframework.spek2.style.specification.describe
|
||||
class IsPropertyNamingSpec : Spek({
|
||||
setupKotlinEnvironment()
|
||||
|
||||
val subject by memoized { IsPropertyNaming() }
|
||||
val subject by memoized { object : IsPropertyNaming() {} }
|
||||
val env: KotlinCoreEnvironment by memoized()
|
||||
|
||||
describe("IsPropertyNaming rule") {
|
||||
@@ -79,7 +79,7 @@ class IsPropertyNamingSpec : Spek({
|
||||
|
||||
context("property declarations") {
|
||||
it("should not detect Kotlin Boolean") {
|
||||
val code = """
|
||||
val code = """
|
||||
class O {
|
||||
var isDefault = false
|
||||
}
|
||||
|
||||
@@ -110,4 +110,4 @@ description: "Meet detekt, a static code analysis tool for Kotlin."
|
||||
url: http://github.com/detekt/detekt
|
||||
baseurl: /
|
||||
|
||||
detekt_version: 1.10.0-RC1
|
||||
detekt_version: 1.10.0
|
||||
|
||||
@@ -10,11 +10,11 @@ toc: true
|
||||
|
||||
##### Notable Changes
|
||||
|
||||
- New rule: `IgnoredReturnValue`
|
||||
- New rules: `IgnoredReturnValue`, `ImplictUnitReturnType`
|
||||
- The complexity report (console/html) now calculates the [cognitive complexity metric](https://www.sonarsource.com/docs/CognitiveComplexity.pdf) for your project.
|
||||
- Issues at functions and classes are now reported at the identifiers. This is especially helpful in the IntelliJ plugin.
|
||||
- Extension authors can now manipulate the findings with the new [ReportingExtension](https://github.com/detekt/detekt/blob/master/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/ReportingExtension.kt).
|
||||
- `detekt-formatting` was updated to use KtLint 0.37.1 which includes a lot of improvements and changes. Please see their [changelog](https://github.com/pinterest/ktlint/releases/tag/0.37.0).
|
||||
- `detekt-formatting` was updated to use KtLint 0.37.2 which includes a lot of improvements and changes. Please see their [changelog](https://github.com/pinterest/ktlint/releases/tag/0.37.0).
|
||||
- New wrapper rules: `SpacingAroundDoubleColon`, `SpacingBetweenDeclarationsWithCommentsRule`, `SpacingBetweenDeclarationsWithAnnotationsRule`
|
||||
- You can configure the [layoutPattern](https://github.com/pinterest/ktlint/blob/0.37.0/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/ImportOrderingRule.kt#L18) for `ImportOrdering` in detekt's configuration file.
|
||||
- `Indentation` rule was replaced with a new [implementation](https://github.com/pinterest/ktlint/pull/758).
|
||||
@@ -38,10 +38,23 @@ There are alternative ways to run these scripts: https://www.jetbrains.com/help/
|
||||
|
||||
##### Changelog
|
||||
|
||||
- UnusedPrivateClass: fix false negative with import directives - [#2817](https://github.com/detekt/detekt/pull/2817)
|
||||
- UnusedPrivateClass: false negative with import directives - [#2816](https://github.com/detekt/detekt/issues/2816)
|
||||
- Publish detekt-bom module - [#2814](https://github.com/detekt/detekt/pull/2814)
|
||||
- [Gradle] Configuration cache support - [#2813](https://github.com/detekt/detekt/pull/2813)
|
||||
- UnusedPrivateClass: don't report imported classes - [#2812](https://github.com/detekt/detekt/pull/2812)
|
||||
- False positive UnusedPrivateClass when importing private enum constants directly. - [#2809](https://github.com/detekt/detekt/issues/2809)
|
||||
- Upgrade ktlint to version 0.37.2 - [#2807](https://github.com/detekt/detekt/pull/2807)
|
||||
- LongMethod: disregard params in method definition - [#2806](https://github.com/detekt/detekt/pull/2806)
|
||||
- LongMethod should not consider parameters while calculating the number of lines - [#2804](https://github.com/detekt/detekt/issues/2804)
|
||||
- Local vars inside object literals can't be const - Closes #2794 - [#2799](https://github.com/detekt/detekt/pull/2799)
|
||||
- MayBeConst should not report properties in local anonymous object declarations - [#2794](https://github.com/detekt/detekt/issues/2794)
|
||||
- Fix false positive for UnusedPrivateClass on generics - [#2793](https://github.com/detekt/detekt/pull/2793)
|
||||
- Report ComplexInterface issues at identifiers - [#2786](https://github.com/detekt/detekt/pull/2786)
|
||||
- Construct signatures based on named declaration instead of just the identifier - [#2785](https://github.com/detekt/detekt/pull/2785)
|
||||
- KtLint to 0.37.1 - [#2783](https://github.com/detekt/detekt/pull/2783)
|
||||
- Implement new rule ImplictUnitReturnTypet - [#2781](https://github.com/detekt/detekt/pull/2781)
|
||||
- Feature/restrict is properties - [#2779](https://github.com/detekt/detekt/pull/2779)
|
||||
- Rename Blacklist and Whitelist to be self explanatory - [#2778](https://github.com/detekt/detekt/pull/2778)
|
||||
- Remove deprecated HierarchicalConfig which could lead to OOM when reusing Config objects - [#2768](https://github.com/detekt/detekt/pull/2768)
|
||||
- Support layout property for ImportOrdering rule - [#2763](https://github.com/detekt/detekt/pull/2763)
|
||||
@@ -70,6 +83,13 @@ There are alternative ways to run these scripts: https://www.jetbrains.com/help/
|
||||
|
||||
##### Housekeeping & Refactorings
|
||||
|
||||
- use parallel build options - [#2808](https://github.com/detekt/detekt/pull/2808)
|
||||
- Compile Test Snippets on Java 14 - [#2803](https://github.com/detekt/detekt/pull/2803)
|
||||
- Cleanup MayBeConst tests - [#2802](https://github.com/detekt/detekt/pull/2802)
|
||||
- Refactor compare_releases script to use clikt - [#2801](https://github.com/detekt/detekt/pull/2801)
|
||||
- Simplify the Code Coverage workflow - [#2798](https://github.com/detekt/detekt/pull/2798)
|
||||
- Run compile-test-snippets in a isolated job - [#2797](https://github.com/detekt/detekt/pull/2797)
|
||||
- Run verifyGeneratorOutput in a isolated job - [#2796](https://github.com/detekt/detekt/pull/2796)
|
||||
- Introduce BoM to manage our own dependencies - [#2792](https://github.com/detekt/detekt/pull/2792)
|
||||
- Smarter Caching on Github Actions - [#2788](https://github.com/detekt/detekt/pull/2788)
|
||||
- Fix config generation directory - [#2782](https://github.com/detekt/detekt/pull/2782)
|
||||
|
||||
@@ -179,27 +179,6 @@ Reports when the package declaration is missing or the file location does not ma
|
||||
|
||||
if specified this part of the package structure is ignored
|
||||
|
||||
### IsPropertyNaming
|
||||
|
||||
Reports when property with 'is' prefix doesn't have a boolean type.
|
||||
Please check the [chapter 8.3.2 at Java Language Specification](https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.3.2)
|
||||
|
||||
**Severity**: Warning
|
||||
|
||||
**Debt**: 5min
|
||||
|
||||
#### Noncompliant Code:
|
||||
|
||||
```kotlin
|
||||
val isEnabled: Int = 500
|
||||
```
|
||||
|
||||
#### Compliant Code:
|
||||
|
||||
```kotlin
|
||||
val isEnabled: Boolean = false
|
||||
```
|
||||
|
||||
### MatchingDeclarationName
|
||||
|
||||
"If a Kotlin file contains a single non-private class (potentially with related top-level declarations),
|
||||
|
||||
@@ -14,11 +14,11 @@ import com.github.ajalt.clikt.core.CliktCommand
|
||||
import com.github.ajalt.clikt.parameters.options.default
|
||||
import com.github.ajalt.clikt.parameters.options.option
|
||||
import com.github.ajalt.clikt.parameters.types.int
|
||||
import org.kohsuke.github.GitHub
|
||||
import org.kohsuke.github.GHIssue
|
||||
import org.kohsuke.github.GHIssueState
|
||||
import org.kohsuke.github.GHMilestone
|
||||
import org.kohsuke.github.GHRepository
|
||||
import org.kohsuke.github.GitHub
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
||||
@@ -72,7 +72,7 @@ class GithubMilestoneReport : CliktCommand() {
|
||||
|
||||
// write report to disk
|
||||
|
||||
val tempFile: File = File.createTempFile(project, "_$milestoneId.title")
|
||||
val tempFile: File = File.createTempFile(project, "_$milestoneId.$milestoneTitle")
|
||||
tempFile.writeText(content)
|
||||
|
||||
println("\nContent saved to ${tempFile.path}")
|
||||
|
||||
Reference in New Issue
Block a user