Minor fix for highlighting of JoinVarArgsContains inspection.

Upgraded to kotlin 1.3.50, intellij plugin 0.4.10, assertj 3.13.2, idea 2019.2.1
This commit is contained in:
Chris Hodges 2019-08-23 18:04:07 +02:00
parent a4535afbbb
commit 36f63d26d2
3 changed files with 12 additions and 14 deletions

View File

@ -537,6 +537,9 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
## Changelog
#### V1.4 (unreleased)
- Minor fix for highlighting of JoinVarArgsContains inspection.
#### V1.3 (03-Aug-19)
- New JoinVarArgsContains inspection that will detect multiple ```.contains()```, ```.doesNotContain()```,
and ```.containsOnlyOnce()``` calls within the same statement that could be joined together using variadic arguments.

View File

@ -1,13 +1,13 @@
plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.4.9'
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
id 'org.jetbrains.intellij' version '0.4.10'
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.8.4'
}
group 'de.platon42'
version '1.3'
version '1.4'
repositories {
mavenCentral()
@ -20,7 +20,7 @@ repositories {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile "org.assertj:assertj-core:3.13.0"
testCompile "org.assertj:assertj-core:3.13.2"
testCompile "org.assertj:assertj-guava:3.2.1"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.1'
@ -35,7 +35,7 @@ compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
intellij {
version '2019.2'
version '2019.2.1'
// pluginName 'Concise AssertJ Optimizing Nitpicker (Cajon)'
updateSinceUntilBuild false
plugins = ['java']
@ -43,14 +43,9 @@ intellij {
patchPluginXml {
changeNotes """
<h4>V1.3 (03-Aug-19)</h4>
<h4>V1.4 (unreleased)</h4>
<ul>
<li>New JoinVarArgsContains inspection that will detect multiple .contains(), .doesNotContain(), and .containsOnlyOnce()
calls within the same statement that could be joined together using variadic arguments.
<li>AssertJ 3.13.0 broke some inspections due to new AbstractStringAssert::isEqualTo() method.
<li>AssertThatJava8Optional and AssertThatGuavaOptional inspections do not longer try to fix
assertThat(optional).isEqualTo(Optional.fromNullable(expression)) to contains()
when expression is not a non-null constant expression.
<li>Minor fix for highlighting of JoinVarArgsContains inspection.
</ul>
<p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
"""

View File

@ -14,7 +14,7 @@ import de.platon42.intellij.plugins.cajon.quickfixes.JoinVarArgsContainsQuickFix
class JoinVarArgsContainsInspection : AbstractAssertJInspection() {
companion object {
private const val DISPLAY_NAME = "Join variadic arguments of contains()/containsOnlyOnce()/doesNotContain()"
private const val DISPLAY_NAME = "Join arguments to variadic for contains()/containsOnlyOnce()/doesNotContain()"
private const val JOIN_VARARGS_MESSAGE = "Calls to same methods may be joined to variadic version"
private val MATCHERS = listOf(MethodNames.CONTAINS, MethodNames.CONTAINS_ONLY_ONCE, MethodNames.DOES_NOT_CONTAIN)
@ -42,7 +42,7 @@ class JoinVarArgsContainsInspection : AbstractAssertJInspection() {
if (onlyAssertionCalls.count(methodMatcher::test) > 1) {
val outmostMethodCall = statement.findOutmostMethodCall() ?: return
val quickFix = JoinVarArgsContainsQuickFix(MATCHERS)
val textRange = TextRange(outmostMethodCall.qualifierExpression.textLength, outmostMethodCall.textLength)
val textRange = TextRange(assertThatCall.textLength, outmostMethodCall.textLength)
holder.registerProblem(outmostMethodCall, textRange, JOIN_VARARGS_MESSAGE, quickFix)
return
}