[Test] Add ability to disable DEBUG_INFO diagnostics except explicitly defined
This commit is contained in:
committed by
TeamCityServer
parent
d44782f49f
commit
6aca0bb374
+7
@@ -70,4 +70,11 @@ object DiagnosticsDirectives : SimpleDirectivesContainer() {
|
||||
(additional to root package)
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
val REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO by directive(
|
||||
description = """
|
||||
If this directive enabled then `DEBUG_INFO_...` diagnostics will be reported
|
||||
only if they are defined in testdata.
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
+6
-2
@@ -119,9 +119,13 @@ class ClassicDiagnosticsHandler(testServices: TestServices) : ClassicFrontendAna
|
||||
info.analysisResult.moduleDescriptor as ModuleDescriptorImpl,
|
||||
diagnosedRanges = diagnosedRanges
|
||||
)
|
||||
debugAnnotations.mapNotNull { debugAnnotation ->
|
||||
val onlyExplicitlyDefined = DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO in module.directives
|
||||
for (debugAnnotation in debugAnnotations) {
|
||||
val factory = debugAnnotation.diagnostic.factory
|
||||
if (!diagnosticsService.shouldRenderDiagnostic(module, factory.name, factory.severity)) return@mapNotNull null
|
||||
if (!diagnosticsService.shouldRenderDiagnostic(module, factory.name, factory.severity)) continue
|
||||
if (onlyExplicitlyDefined && !debugAnnotation.diagnostic.textRanges.any { it.startOffset..it.endOffset in diagnosedRanges }) {
|
||||
continue
|
||||
}
|
||||
reporter.reportDiagnostic(debugAnnotation.diagnostic, module, file, configuration, withNewInferenceModeEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user