Skip to content

Commit

Permalink
Update all non-major dependencies (except core Kotlin) to v3.1.0 (#1454)
Browse files Browse the repository at this point in the history
* fixed code style issues found by detekt
* fixed gradle build

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nariman Abdullin <nulls.narik@gmail.com>
  • Loading branch information
renovate[bot] and nulls authored Aug 10, 2022
1 parent b4e846b commit f791e1a
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 39 deletions.
16 changes: 9 additions & 7 deletions diktat-gradle-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
<packaging>pom</packaging>

<properties>
<gradle.executable>${project.basedir}/gradlew</gradle.executable>
<gradle.workingDir>${project.basedir}</gradle.workingDir>
<gradle.executable>gradlew</gradle.executable>
<gradle.task>build</gradle.task>
<gradle.builddir>build</gradle.builddir>
<skip.gradle.build>false</skip.gradle.build>
<skip.gradle.test>false</skip.gradle.test>
<!-- This property is set to excluded task in the specific build profile -->
<gradle.exclude.check></gradle.exclude.check>
</properties>

<dependencies>
Expand Down Expand Up @@ -61,12 +60,15 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<workingDirectory>${gradle.workingDir}</workingDirectory>
<executable>${gradle.workingDir}/${gradle.executable}</executable>
</configuration>
<executions>
<execution>
<id>gradle-test</id>
<phase>test</phase>
<configuration>
<executable>${gradle.executable}</executable>
<arguments>
<argument>clean</argument>
<argument>test</argument>
Expand All @@ -88,7 +90,6 @@
<id>gradle</id>
<phase>prepare-package</phase>
<configuration>
<executable>${gradle.executable}</executable>
<arguments>
<argument>${gradle.task}</argument>
<argument>-Pgroup=${project.groupId}</argument>
Expand All @@ -98,7 +99,8 @@
<argument>-PjunitVersion=${junit.version}</argument>
<argument>-PjacocoVersion=${jacoco.version}</argument>
<argument>-S</argument>
<argument>${gradle.exclude.check}</argument>
<!-- This argument can be set to excluded task in the specific build profile -->
<!-- <argument></argument>-->
</arguments>
<skip>${skip.gradle.build}</skip>
</configuration>
Expand Down Expand Up @@ -185,7 +187,7 @@
</os>
</activation>
<properties>
<gradle.executable>${project.basedir}/gradlew.bat</gradle.executable>
<gradle.executable>gradlew.bat</gradle.executable>
</properties>
</profile>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class KdocFormatting(configRules: List<RulesConfig>) : DiktatRule(
val kdocTags = node.kDocTags()
// distinct basic tags which are present in current KDoc, in proper order
val basicTagsOrdered = basicTagsList.filter { basicTag ->
kdocTags.find { it.knownTag == basicTag } != null
kdocTags.any { it.knownTag == basicTag }
}
// all basic tags from current KDoc
val basicTags = kdocTags.filter { basicTagsOrdered.contains(it.knownTag) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MagicNumberRule(configRules: List<RulesConfig>) : DiktatRule(
this.findChildByType(OPERATION_REFERENCE)?.hasChildOfType(RANGE) ?: false
}
val isExtensionFunctions = node.parent({ it.elementType == FUN && (it.psi as KtFunction).isExtensionDeclaration() }) != null &&
node.parents().find { it.elementType == PROPERTY } == null
node.parents().none { it.elementType == PROPERTY }
val result = listOf(isHashFunction, isPropertyDeclaration, isLocalVariable, isValueParameter, isConstant,
isCompanionObjectProperty, isEnums, isRanges, isExtensionFunctions).zip(mapConfiguration.map { configuration.getParameter(it.key) })
if (result.any { it.first && it.first != it.second } && !isIgnoreNumber) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,14 @@ class SortRule(configRules: List<RulesConfig>) : DiktatRule(

@Suppress("TYPE_ALIAS")
private fun createOrderListOfList(propertyList: List<ASTNode>): List<List<ASTNode>> {
var oneOrderList = mutableListOf(propertyList.first())
val oneOrderList = mutableListOf(propertyList.first())
val orderListOfList: MutableList<MutableList<ASTNode>> = mutableListOf()
propertyList.zipWithNext().forEach { (currentProperty, nextProperty) ->
if (currentProperty.nextSibling { it.elementType == PROPERTY } == nextProperty) {
oneOrderList.add(nextProperty)
} else {
orderListOfList.add(oneOrderList)
oneOrderList = mutableListOf(nextProperty)
if (currentProperty.nextSibling { it.elementType == PROPERTY } != nextProperty) {
orderListOfList.add(oneOrderList.toMutableList())
oneOrderList.clear()
}
oneOrderList.add(nextProperty)
}
orderListOfList.add(oneOrderList)
return orderListOfList.toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class TrailingCommaRule(configRules: List<RulesConfig>) : DiktatRule(

private fun ASTNode.checkTrailingComma(config: Boolean) {
val shouldFix = this.siblings(true).toList().run {
!this.map { it.elementType }.contains(COMMA) && this.find { it.isWhiteSpaceWithNewline() || it.isPartOfComment() } != null
!this.map { it.elementType }.contains(COMMA) && this.any { it.isWhiteSpaceWithNewline() || it.isPartOfComment() }
}
if (shouldFix && config) {
// we should write type of node in warning, to make it easier for user to find the parameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,15 +641,13 @@ class NewlinesRule(configRules: List<RulesConfig>) : DiktatRule(
return false
}
val callsByNewLine: ListOfList = mutableListOf()
var callsInOneNewLine: MutableList<ASTNode> = mutableListOf()
val callsInOneNewLine: MutableList<ASTNode> = mutableListOf()
this.forEach { astNode ->
if (astNode.treePrev.isFollowedByNewline() || astNode.treePrev.isWhiteSpaceWithNewline()) {
callsByNewLine.add(callsInOneNewLine)
callsInOneNewLine = mutableListOf()
callsInOneNewLine.add(astNode)
} else {
callsInOneNewLine.add(astNode)
callsByNewLine.add(callsInOneNewLine.toMutableList())
callsInOneNewLine.clear()
}
callsInOneNewLine.add(astNode)
if (astNode.treePrev.elementType == POSTFIX_EXPRESSION && !astNode.treePrev.isFollowedByNewline() && configuration.maxCallsInOneLine == 1) {
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class SingleInitRule(configRules: List<RulesConfig>) : DiktatRule(
.filter { it.left is KtNameReferenceExpression }
.filter { statement ->
statement.right?.node?.findAllDescendantsWithSpecificType(REFERENCE_EXPRESSION)?.all { arg ->
propertiesFromClassBody.any { (it.psi as KtProperty).name == arg.text } || propertiesFromPrimaryConstructor?.find { it == arg.text } != null
propertiesFromClassBody.any { (it.psi as KtProperty).name == arg.text } || propertiesFromPrimaryConstructor?.any { it == arg.text } == true
} ?: false
}
.groupBy { assignment ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,12 +702,11 @@ fun List<ASTNode>.handleIncorrectOrder(
*/
@Suppress("WRONG_NEWLINES")
fun ASTNode.extractLineOfText(): String {
var text: MutableList<String> = mutableListOf()
val text: MutableList<String> = mutableListOf()
siblings(false)
.map { it.text.split("\n") }
.takeWhileInclusive { it.size <= 1 }
.forEach { text.add(it.last()) }
text = text.asReversed()
.forEach { text.add(0, it.last()) }
text.add(this.text)
val nextNode = parent({ it.treeNext != null }, false) ?: this
nextNode.siblings(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun ASTNode.kDocTags(): List<KDocTag> {
* @return whether this tag is present
*/
fun Iterable<KDocTag>.hasKnownKdocTag(knownTag: KDocKnownTag): Boolean =
this.find { it.knownTag == knownTag } != null
this.any { it.knownTag == knownTag }

/**
* Checks for trailing newlines in tag's body. Handles cases, when there is no leading asterisk on an empty line:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AvailableRulesDocTest {

allRulesFromCode.forEach { warning ->
val ruleName = warning.ruleName()
val ruleFound = allRulesFromDoc.find { it.trim() == ruleName } != null
val ruleFound = allRulesFromDoc.any { it.trim() == ruleName }
Assertions.assertTrue(ruleFound) {
val docs = "| | | $ruleName" +
"| | | | |"
Expand All @@ -47,10 +47,10 @@ class AvailableRulesDocTest {

allRulesFromDoc.forEach { warning ->
val trimmedWarning = warning.trim()
val ruleFound = allRulesFromCode.find { it.ruleName() == trimmedWarning } != null
val ruleFound = allRulesFromCode.any { it.ruleName() == trimmedWarning }
Assertions.assertTrue(ruleFound) {
"""
Found rule (warning) in documentation: <$trimmedWarning> that does not exist in the code. Misprint or configuration was renamed?
Found rule (warning) in documentation: <$trimmedWarning> that does not exist in the code. Misprint or configuration was renamed?
""".trimIndent()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class RulesConfigYamlTest {

allRulesFromConfig.forEach { warning ->
val warningName = warning.name
val ruleFound = allRulesFromCode.find { it.ruleName() == warningName || warningName == "DIKTAT_COMMON" } != null
val ruleFound = allRulesFromCode.any { it.ruleName() == warningName || warningName == "DIKTAT_COMMON" }
Assertions.assertTrue(ruleFound) {
"""
Found rule (warning) in $filePath: <$warningName> that does not exist in the code. Misprint or configuration was renamed?
Found rule (warning) in $filePath: <$warningName> that does not exist in the code. Misprint or configuration was renamed?
""".trimIndent()
}
}
Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
<kotlin.code.style>official</kotlin.code.style>
<kotlinx.serialization.version>1.3.3</kotlinx.serialization.version>
<ktlint.version>0.46.1</ktlint.version>
<junit.version>5.8.2</junit.version>
<junit.platform.version>1.8.2</junit.platform.version>
<junit.version>5.9.0</junit.version>
<junit.platform.version>1.9.0</junit.platform.version>
<guava.version>31.1-jre</guava.version>
<slf4j.version>1.7.36</slf4j.version>
<commons-cli.version>1.5.0</commons-cli.version>
<diktat-check.version>1.2.3</diktat-check.version>
<kotlinpoet.version>1.12.0</kotlinpoet.version>
<detekt.version>1.20.0</detekt.version>
<dokka.version>1.7.0</dokka.version>
<detekt.version>1.21.0</detekt.version>
<dokka.version>1.7.10</dokka.version>
<jacoco.version>0.8.8</jacoco.version>
<maven-plugin-tools.version>3.6.4</maven-plugin-tools.version>
<jbool.version>1.23</jbool.version>
Expand Down Expand Up @@ -244,7 +244,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M2</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -254,7 +254,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
Expand Down Expand Up @@ -316,7 +316,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand Down

0 comments on commit f791e1a

Please sign in to comment.