Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change requires type resolution rule warning to debug level to not spam the user console #5353

Merged
merged 1 commit into from Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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