Move implementation of runForWholeFile field to xml

This commit is contained in:
Dmitry Gridin
2020-03-23 20:59:24 +07:00
parent f92936ae12
commit 32dba0afa2
8 changed files with 8 additions and 8 deletions
@@ -1751,6 +1751,7 @@
enabledByDefault="false" enabledByDefault="false"
level="WEAK WARNING" level="WEAK WARNING"
language="kotlin" language="kotlin"
runForWholeFile="true"
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceCollectionCountWithSizeInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceCollectionCountWithSizeInspection"
@@ -1976,6 +1977,7 @@
enabledByDefault="false" enabledByDefault="false"
level="WARNING" level="WARNING"
language="kotlin" language="kotlin"
runForWholeFile="true"
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection"
@@ -1757,6 +1757,7 @@
enabledByDefault="false" enabledByDefault="false"
level="WEAK WARNING" level="WEAK WARNING"
language="kotlin" language="kotlin"
runForWholeFile="true"
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceCollectionCountWithSizeInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceCollectionCountWithSizeInspection"
@@ -1982,6 +1983,7 @@
enabledByDefault="false" enabledByDefault="false"
level="WARNING" level="WARNING"
language="kotlin" language="kotlin"
runForWholeFile="true"
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection"
@@ -1757,6 +1757,7 @@
enabledByDefault="false" enabledByDefault="false"
level="WEAK WARNING" level="WEAK WARNING"
language="kotlin" language="kotlin"
runForWholeFile="true"
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceCollectionCountWithSizeInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceCollectionCountWithSizeInspection"
@@ -1982,6 +1983,7 @@
enabledByDefault="false" enabledByDefault="false"
level="WARNING" level="WARNING"
language="kotlin" language="kotlin"
runForWholeFile="true"
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection"
@@ -111,8 +111,6 @@ class KotlinUnusedImportInspection : AbstractKotlinInspection() {
} }
} }
override fun runForWholeFile() = true
override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array<out ProblemDescriptor>? { override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array<out ProblemDescriptor>? {
if (file !is KtFile) return null if (file !is KtFile) return null
val data = analyzeImports(file) ?: return null val data = analyzeImports(file) ?: return null
@@ -38,8 +38,6 @@ class ReformatInspection : LocalInspectionTool() {
@XmlAttribute @XmlAttribute
var processChangedFilesOnly: Boolean = false var processChangedFilesOnly: Boolean = false
override fun runForWholeFile(): Boolean = true
override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array<out ProblemDescriptor>? { override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array<out ProblemDescriptor>? {
return checkFile(file, isOnTheFly)?.toTypedArray() return checkFile(file, isOnTheFly)?.toTypedArray()
} }
@@ -198,8 +198,6 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
} }
} }
override fun runForWholeFile() = true
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor { override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
return namedDeclarationVisitor(fun(declaration) { return namedDeclarationVisitor(fun(declaration) {
ProgressManager.checkCanceled() ProgressManager.checkCanceled()
@@ -52,8 +52,6 @@ class KDocMissingDocumentationInspection : AbstractKotlinInspection() {
} }
override fun runForWholeFile(): Boolean = true
class AddDocumentationFix : LocalQuickFix { class AddDocumentationFix : LocalQuickFix {
override fun getName(): String = KotlinBundle.message("add.documentation.fix.text") override fun getName(): String = KotlinBundle.message("add.documentation.fix.text")
@@ -110,8 +110,10 @@ class InspectionDescriptionTest : LightPlatformTestCase() {
checkValue(failMessages, toolName, "suppressId", ep.id, ep.getShortName(), tool.id) checkValue(failMessages, toolName, "suppressId", ep.id, ep.getShortName(), tool.id)
checkValue(failMessages, toolName, "alternateId", ep.alternativeId, null, tool.alternativeID) checkValue(failMessages, toolName, "alternateId", ep.alternativeId, null, tool.alternativeID)
checkValue(failMessages, toolName, "shortName", ep.getShortName(), null, tool.shortName) checkValue(failMessages, toolName, "shortName", ep.getShortName(), null, tool.shortName)
checkValue(failMessages, toolName, "runForWholeFile", null, "false", tool.runForWholeFile().toString())
} }
} }
UsefulTestCase.assertEmpty(StringUtil.join(failMessages, "\n"), failMessages) UsefulTestCase.assertEmpty(StringUtil.join(failMessages, "\n"), failMessages)
} }