"Unused equals expression" inspection: highlight whole expression with yellow background

^KT-41615 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-09-04 09:45:15 +02:00
committed by Vladimir Dolzhenko
parent b81ec2c8f0
commit 343010a833
9 changed files with 103 additions and 23 deletions
@@ -4,8 +4,11 @@
<line>4</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="simple.kt"/>
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == b</highlighted_element>
<offset>4</offset>
<length>6</length>
</problem>
<problem>
@@ -13,8 +16,11 @@
<line>5</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="simple.kt"/>
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == 1</highlighted_element>
<offset>4</offset>
<length>6</length>
</problem>
<problem>
@@ -22,8 +28,11 @@
<line>8</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="simple.kt"/>
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == b</highlighted_element>
<offset>8</offset>
<length>6</length>
</problem>
<problem>
@@ -31,8 +40,11 @@
<line>13</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="simple.kt"/>
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == b</highlighted_element>
<offset>8</offset>
<length>6</length>
</problem>
<problem>
@@ -40,8 +52,11 @@
<line>14</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="simple.kt"/>
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == b</highlighted_element>
<offset>8</offset>
<length>6</length>
</problem>
<problem>
@@ -49,8 +64,11 @@
<line>18</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="simple.kt"/>
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == b</highlighted_element>
<offset>4</offset>
<length>6</length>
</problem>
<problem>
@@ -58,8 +76,11 @@
<line>38</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="simple.kt"/>
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == 1</highlighted_element>
<offset>12</offset>
<length>6</length>
</problem>
<problem>
@@ -67,8 +88,11 @@
<line>61</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == -1</highlighted_element>
<offset>28</offset>
<length>7</length>
</problem>
<problem>
@@ -76,8 +100,11 @@
<line>61</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>a == -1</highlighted_element>
<offset>28</offset>
<length>7</length>
</problem>
<problem>
@@ -85,8 +112,11 @@
<line>71</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>it == null</highlighted_element>
<offset>34</offset>
<length>10</length>
</problem>
<problem>
@@ -94,8 +124,11 @@
<line>75</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>it.equals(null)</highlighted_element>
<offset>34</offset>
<length>15</length>
</problem>
<problem>
@@ -103,7 +136,10 @@
<line>81</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused equals expression</problem_class>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unused equals expression</problem_class>
<description>Unused equals expression</description>
<highlighted_element>equals(null)</highlighted_element>
<offset>48</offset>
<length>12</length>
</problem>
</problems>
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.UnusedEqualsInspection
+4
View File
@@ -0,0 +1,4 @@
// FIX: none
fun foo(a: Int, b: Int) {
<caret>a.equals(b)
}
@@ -0,0 +1,4 @@
// FIX: none
fun foo(a: Int, b: Int) {
a.equals(b)<caret>
}
+4
View File
@@ -0,0 +1,4 @@
// FIX: none
fun foo(a: Int, b: Int) {
<caret>a == b
}
@@ -0,0 +1,4 @@
// FIX: none
fun foo(a: Int, b: Int) {
a == b<caret>
}