Apply same style for top-level and object properties

#KT-20437 Fixed
This commit is contained in:
Dmitry Jemerov
2017-12-29 17:35:11 +01:00
parent 1c7d97289b
commit f83c5344d7
8 changed files with 80 additions and 26 deletions
@@ -0,0 +1,16 @@
<problems>
<problem>
<file>test.kt</file>
<line>5</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Object or top-level property name &lt;code&gt;_FOO&lt;/code&gt; should not start with an underscore #loc</description>
</problem>
<problem>
<file>test.kt</file>
<line>21</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Object or top-level property name &lt;code&gt;_FOO&lt;/code&gt; should not start with an underscore #loc</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.ObjectPropertyNameInspection
+34
View File
@@ -0,0 +1,34 @@
val Foo: String = ""
var FOO_BAR: Int = 0
var _FOO: Int = 0
const val THREE = 3
val xyzzy = 1
fun foo() {
val XYZZY = 1
val BAR_BAZ = 2
}
object Foo {
val Foo: String = ""
var FOO_BAR: Int = 0
var _FOO: Int = 0
}
class D {
private val _foo: String
private val FOO_BAR: String
companion object {
val Foo: String = ""
var FOO_BAR: Int = 0
}
}
@@ -1,16 +1,9 @@
<problems>
<problem>
<file>test.kt</file>
<line>1</line>
<line>27</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Property name &lt;code&gt;Foo&lt;/code&gt; should start with a lowercase letter #loc</description>
</problem>
<problem>
<file>test.kt</file>
<line>3</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Property name &lt;code&gt;FOO_BAR&lt;/code&gt; should not contain underscores #loc</description>
<description>Property name &lt;code&gt;_Foo&lt;/code&gt; should not start with an underscore #loc</description>
</problem>
</problems>
+4
View File
@@ -2,6 +2,8 @@ val Foo: String = ""
var FOO_BAR: Int = 0
var _FOO: Int = 0
const val THREE = 3
val xyzzy = 1
@@ -22,6 +24,8 @@ class D {
private val FOO_BAR: String
val _Foo: String
companion object {
val Foo: String = ""