Skip to content

Commit

Permalink
Change requires type resolution rule warning to debug level to not sp…
Browse files Browse the repository at this point in the history
…am the user console (#5353)
  • Loading branch information
arturbosch committed Sep 26, 2022
1 parent bb0f6cd commit dbc89c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -43,7 +43,6 @@ internal class Analyzer(
): Map<RuleSetId, List<Finding>> {
val languageVersionSettings = settings.environment.configuration.languageVersionSettings

@Suppress("DEPRECATION")
val dataFlowValueFactory = DataFlowValueFactoryImpl(languageVersionSettings)
val compilerResources = CompilerResources(languageVersionSettings, dataFlowValueFactory)
val findingsPerFile: FindingsResult =
Expand All @@ -52,8 +51,9 @@ internal class Analyzer(
} else {
runSync(ktFiles, bindingContext, compilerResources)
}

if (bindingContext == BindingContext.EMPTY) {
warnAboutEnabledRequiresTypeResolutionRules(settings::info)
warnAboutEnabledRequiresTypeResolutionRules()
}

val findingsPerRuleSet = HashMap<RuleSetId, List<Finding>>()
Expand Down Expand Up @@ -144,7 +144,7 @@ internal class Analyzer(
return result
}

private fun warnAboutEnabledRequiresTypeResolutionRules(log: (String) -> Unit) {
private fun warnAboutEnabledRequiresTypeResolutionRules() {
providers.asSequence()
.map { it to config.subConfig(it.ruleSetId) }
.filter { (_, ruleSetConfig) -> ruleSetConfig.isActive() }
Expand All @@ -153,7 +153,7 @@ internal class Analyzer(
.filter { rule -> (rule as? Rule)?.active == true }
.filter { rule -> rule::class.hasAnnotation<RequiresTypeResolution>() }
.forEach { rule ->
log("The rule '${rule.ruleId}' requires type resolution but it was run without it.")
settings.debug { "The rule '${rule.ruleId}' requires type resolution but it was run without it." }
}
}
}
Expand Down
Expand Up @@ -27,6 +27,7 @@ fun createProcessingSettings(
inputPaths = listOfNotNull(inputPath)
}
logging {
debug = true
this.outputChannel = outputChannel
errorChannel = NullPrintStream()
}
Expand Down

0 comments on commit dbc89c0

Please sign in to comment.