Refactoring: rename SameVersionIDEPluginInspection

It now has better suppression string
This commit is contained in:
Nikolay Krasko
2016-07-06 13:20:54 +03:00
parent 16b8f3fd57
commit 8450921b58
7 changed files with 46 additions and 5 deletions
@@ -27,7 +27,7 @@ import org.jetbrains.idea.maven.project.MavenProjectsManager
import org.jetbrains.kotlin.idea.maven.PomFile
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
class SameVersionIDEPluginInspection : DomElementsInspection<MavenDomProjectModel>(MavenDomProjectModel::class.java) {
class DifferentKotlinMavenVersionInspection : DomElementsInspection<MavenDomProjectModel>(MavenDomProjectModel::class.java) {
private val idePluginVersion by lazy { bundledRuntimeVersion() }
var testVersionMessage: String? = null
@@ -37,7 +37,7 @@ import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
import com.intellij.util.indexing.FileBasedIndex
import org.jetbrains.jps.model.java.JavaSourceRootType
import org.jetbrains.kotlin.idea.maven.inspections.KotlinMavenPluginPhaseInspection
import org.jetbrains.kotlin.idea.maven.inspections.SameVersionIDEPluginInspection
import org.jetbrains.kotlin.idea.maven.inspections.DifferentKotlinMavenVersionInspection
import org.jetbrains.kotlin.idea.refactoring.toPsiDirectory
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
import java.io.File
@@ -156,7 +156,7 @@ abstract class AbstractKotlinMavenInspectionTest : MavenImportingTestCase() {
val toolWrapper = LocalInspectionToolWrapper(inspectionClass.newInstance() as LocalInspectionTool)
val tool = toolWrapper.tool
if (tool is SameVersionIDEPluginInspection) {
if (tool is DifferentKotlinMavenVersionInspection) {
tool.testVersionMessage = "\$PLUGIN_VERSION"
}
@@ -53,6 +53,12 @@ public class KotlinMavenInspectionTestGenerated extends AbstractKotlinMavenInspe
doTest(fileName);
}
@TestMetadata("ideAndMavenVersionsSuppression.xml")
public void testIdeAndMavenVersionsSuppression() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-maven/testData/maven-inspections/ideAndMavenVersionsSuppression.xml");
doTest(fileName);
}
@TestMetadata("kotlinTestWithJunit.xml")
public void testKotlinTestWithJunit() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-maven/testData/maven-inspections/kotlinTestWithJunit.xml");
@@ -31,5 +31,5 @@
</build>
</project>
<!-- inspection: org.jetbrains.kotlin.idea.maven.inspections.SameVersionIDEPluginInspection -->
<!-- inspection: org.jetbrains.kotlin.idea.maven.inspections.DifferentKotlinMavenVersionInspection -->
<!-- problem: on ${kotlin.version}, title Kotlin version that is used for building with Maven (1.0.0) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION) -->
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin.test</groupId>
<artifactId>configure-maven-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<kotlin.version>1.0.0</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<!--suppress DifferentKotlinMavenVersion -->
<version>${kotlin.version}</version>
</plugin>
</plugins>
</build>
</project>
<!-- inspection: org.jetbrains.kotlin.idea.maven.inspections.DifferentKotlinMavenVersionInspection -->
+1 -1
View File
@@ -44,7 +44,7 @@
hasStaticDescription="true"
level="WARNING" />
<localInspection implementationClass="org.jetbrains.kotlin.idea.maven.inspections.SameVersionIDEPluginInspection"
<localInspection implementationClass="org.jetbrains.kotlin.idea.maven.inspections.DifferentKotlinMavenVersionInspection"
displayName="Maven and IDE plugins versions are different"
groupName="Kotlin"
enabledByDefault="true"