Naming convention inspections

This commit is contained in:
Dmitry Jemerov
2017-06-14 14:04:25 +02:00
parent 6a5d8dcc82
commit f7c17d6a64
29 changed files with 572 additions and 31 deletions
@@ -0,0 +1,26 @@
<problems>
<problem>
<file>test.kt</file>
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class naming convention</problem_class>
<description>Class name &lt;code&gt;a&lt;/code&gt; doesn't match regex '[A-Z][A-Za-z\d]*' #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" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class naming convention</problem_class>
<description>Class name &lt;code&gt;b&lt;/code&gt; doesn''t match regex '[A-Z][A-Za-z\d]*' #loc</description>
</problem>
<problem>
<file>test.kt</file>
<line>5</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class naming convention</problem_class>
<description>Class name &lt;code&gt;FOO_BAR&lt;/code&gt; doesn''t match regex '[A-Z][A-Za-z\d]*' #loc</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.ClassNameInspection
+13
View File
@@ -0,0 +1,13 @@
class a
object b
object FOO_BAR
enum class Foo {
BAR_BAZ,
BAZ_BAR,
GoodName,
_Foo,
quuxDoo,
}
@@ -0,0 +1,16 @@
<problems>
<problem>
<file>test.kt</file>
<line>11</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Enum entry name &lt;code&gt;_Foo&lt;/code&gt; doesn't match regex '[A-Z]([A-Za-z\d]*|[A-Z_\d]*)' #loc</description>
</problem>
<problem>
<file>test.kt</file>
<line>12</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Enum entry name &lt;code&gt;quuxDoo&lt;/code&gt; doesn't match regex '[A-Z]([A-Za-z\d]*|[A-Z_\d]*)' #loc</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.EnumEntryNameInspection
+13
View File
@@ -0,0 +1,13 @@
class a
object b
object FOO_BAR
enum class Foo {
BAR_BAZ,
BAZ_BAR,
GoodName,
_Foo,
quuxDoo,
}
@@ -0,0 +1,16 @@
<problems>
<problem>
<file>test.kt</file>
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Function name &lt;code&gt;Foo&lt;/code&gt; doesn't match regex '[a-z][A-Za-z\d]*' #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>Function name &lt;code&gt;FOO_BAR&lt;/code&gt; doesn't match regex '[a-z][A-Za-z\d]*' #loc</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.FunctionNameInspection
+5
View File
@@ -0,0 +1,5 @@
fun Foo() {}
fun FOO_BAR() {}
fun xyzzy() {}
@@ -0,0 +1,9 @@
<problems>
<problem>
<file>test.kt</file>
<line>23</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<description>Private property name &lt;code&gt;FOO_BAR&lt;/code&gt; doesn't match regex '[a-z][A-Za-z\d]*' #loc</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.PrivatePropertyNameInspection
@@ -0,0 +1,32 @@
val Foo: String = ""
var FOO_BAR: 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
}
class D {
private val _foo: String
private val FOO_BAR: String
companion object {
val Foo: String = ""
var FOO_BAR: Int = 0
private val FOO_BAZ = 1
}
}
@@ -0,0 +1,16 @@
<problems>
<problem>
<file>test.kt</file>
<line>1</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; doesn't match regex '[a-z][A-Za-z\d]*' #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; doesn't match regex '[a-z][A-Za-z\d]*' #loc</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.PropertyNameInspection
+30
View File
@@ -0,0 +1,30 @@
val Foo: String = ""
var FOO_BAR: 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
}
class D {
private val _foo: String
private val FOO_BAR: String
companion object {
val Foo: String = ""
var FOO_BAR: Int = 0
}
}