Add inspection to detect public API with implicit type
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>4</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Public API declaration has implicit return type</problem_class>
|
||||
<description>For API stability, it's recommended to specify explicitly public & protected declaration types</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>14</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Public API declaration has implicit return type</problem_class>
|
||||
<description>For API stability, it's recommended to specify explicitly public & protected declaration types</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>17</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Public API declaration has implicit return type</problem_class>
|
||||
<description>For API stability, it's recommended to specify explicitly public & protected declaration types</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>20</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Public API declaration has implicit return type</problem_class>
|
||||
<description>For API stability, it's recommended to specify explicitly public & protected declaration types</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+1
@@ -0,0 +1 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.PublicApiImplicitTypeInspection
|
||||
@@ -0,0 +1,29 @@
|
||||
fun foo(): Int = 42
|
||||
|
||||
// !
|
||||
fun bar() = 42
|
||||
|
||||
fun baz() {
|
||||
fun bar() = 42
|
||||
}
|
||||
|
||||
class My {
|
||||
fun foo(): Int = 42
|
||||
|
||||
// !
|
||||
fun bar() = 42
|
||||
|
||||
// !
|
||||
protected val x = ""
|
||||
|
||||
// !
|
||||
val y get() = true
|
||||
|
||||
private val z = 0
|
||||
}
|
||||
|
||||
private class Your {
|
||||
fun bar() = 42
|
||||
|
||||
val x = ""
|
||||
}
|
||||
Reference in New Issue
Block a user