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:
parent
a4535afbbb
commit
36f63d26d2
@ -537,6 +537,9 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
#### V1.4 (unreleased)
|
||||||
|
- Minor fix for highlighting of JoinVarArgsContains inspection.
|
||||||
|
|
||||||
#### V1.3 (03-Aug-19)
|
#### V1.3 (03-Aug-19)
|
||||||
- New JoinVarArgsContains inspection that will detect multiple ```.contains()```, ```.doesNotContain()```,
|
- New JoinVarArgsContains inspection that will detect multiple ```.contains()```, ```.doesNotContain()```,
|
||||||
and ```.containsOnlyOnce()``` calls within the same statement that could be joined together using variadic arguments.
|
and ```.containsOnlyOnce()``` calls within the same statement that could be joined together using variadic arguments.
|
||||||
|
19
build.gradle
19
build.gradle
@ -1,13 +1,13 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.jetbrains.intellij' version '0.4.9'
|
id 'org.jetbrains.intellij' version '0.4.10'
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
|
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
id 'com.github.kt3k.coveralls' version '2.8.4'
|
id 'com.github.kt3k.coveralls' version '2.8.4'
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'de.platon42'
|
group 'de.platon42'
|
||||||
version '1.3'
|
version '1.4'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -20,7 +20,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
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"
|
testCompile "org.assertj:assertj-guava:3.2.1"
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.1'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.1'
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.1'
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.1'
|
||||||
@ -35,7 +35,7 @@ compileTestKotlin {
|
|||||||
kotlinOptions.jvmTarget = "1.8"
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
}
|
}
|
||||||
intellij {
|
intellij {
|
||||||
version '2019.2'
|
version '2019.2.1'
|
||||||
// pluginName 'Concise AssertJ Optimizing Nitpicker (Cajon)'
|
// pluginName 'Concise AssertJ Optimizing Nitpicker (Cajon)'
|
||||||
updateSinceUntilBuild false
|
updateSinceUntilBuild false
|
||||||
plugins = ['java']
|
plugins = ['java']
|
||||||
@ -43,14 +43,9 @@ intellij {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
changeNotes """
|
changeNotes """
|
||||||
<h4>V1.3 (03-Aug-19)</h4>
|
<h4>V1.4 (unreleased)</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>New JoinVarArgsContains inspection that will detect multiple .contains(), .doesNotContain(), and .containsOnlyOnce()
|
<li>Minor fix for highlighting of JoinVarArgsContains inspection.
|
||||||
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.
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
|
<p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
|
||||||
"""
|
"""
|
||||||
|
@ -14,7 +14,7 @@ import de.platon42.intellij.plugins.cajon.quickfixes.JoinVarArgsContainsQuickFix
|
|||||||
class JoinVarArgsContainsInspection : AbstractAssertJInspection() {
|
class JoinVarArgsContainsInspection : AbstractAssertJInspection() {
|
||||||
|
|
||||||
companion object {
|
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 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)
|
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) {
|
if (onlyAssertionCalls.count(methodMatcher::test) > 1) {
|
||||||
val outmostMethodCall = statement.findOutmostMethodCall() ?: return
|
val outmostMethodCall = statement.findOutmostMethodCall() ?: return
|
||||||
val quickFix = JoinVarArgsContainsQuickFix(MATCHERS)
|
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)
|
holder.registerProblem(outmostMethodCall, textRange, JOIN_VARARGS_MESSAGE, quickFix)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user