Add inspection for check/require/checkNotNull/requireNotNull

#KT-30640 Fixed
#KT-22412 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-04-10 10:32:29 +03:00
committed by Mikhail Glukhikh
parent 64780293d3
commit 90b0ea73dc
30 changed files with 458 additions and 40 deletions
@@ -3428,6 +3428,15 @@
language="kotlin"
/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceGuardClauseWithFunctionCallInspection"
displayName="Replace guard clause with kotlin's function call"
groupPath="Kotlin"
groupName="Style issues"
enabledByDefault="true"
level="WEAK WARNING"
language="kotlin"
/>
<referenceImporter implementation="org.jetbrains.kotlin.idea.quickfix.KotlinReferenceImporter"/>
<fileType.fileViewProviderFactory filetype="KJSM" implementationClass="com.intellij.psi.ClassFileViewProviderFactory"/>
@@ -0,0 +1,11 @@
<html>
<body>
This inspection reports guard clause that can be replaced with kotlin's function call. For example:
<br /><br />
<pre>
fun test(foo: Int?) {
if (foo == null) throw IllegalArgumentException("foo") // Replace guard clause with kotlin's function call
}
</pre>
</body>
</html>