Atul Gupta
05/18/2023, 6:04 PMAbsentOrWrongFileLicense
in my project, my detekt
config.yml
file is inside a convention plugin. But AbsentOrWrongFileLicense
is not detecting anything while If I enable the same rule in detekt
repo AbsentOrWrongFileLicense
is correctly detecting all the violations.
Only difference is that in my setup detekt
integration is inside my custom plugin while in detekt
repo it is configure in top level build.gradle
Below is my setup
class CustomDetektPlugin : Plugin<Project>
{
override fun apply(target: Project)
{
with(target) {
apply<DetektPlugin>()
extensions.configure<DetektExtension> {
// If set to `true` the build does not fail when the
// maxIssues count was reached. Defaults to `false`.
ignoreFailures = false
// point to your custom config defining rules to run, overwriting default behavior
config.setFrom("$rootDir/Configs/config/detekt/detekt.yml")
// a way of suppressing issues before introducing detekt
baseline = file("$projectDir/config/detekt/baseline.xml")
// Specify the base path for file paths in the formatted reports.
// If not set, all file paths reported will be absolute file path.
basePath = projectDir.toString()
// Adds debug output during task execution. `false` by default.
debug = true
parallel = true
buildUponDefaultConfig = true
// Turn this on for auto correcting the code on Gradle build
// autoCorrect = true
}
dependencies.add(CONFIGURATION_DETEKT_PLUGINS, libs.findLibrary("detekt.ktlint").get())
}
}
}
Atul Gupta
05/18/2023, 6:07 PMcomments:
active: true
AbsentOrWrongFileLicense:
active: true
licenseTemplateFile: 'license.template'
licenseTemplateIsRegex: true
I have license processor enabled as below
processors:
active: false
exclude:
- 'DetektProgressListener'
# - 'KtFileCountProcessor'
# - 'PackageCountProcessor'
# - 'ClassCountProcessor'
# - 'FunctionCountProcessor'
# - 'PropertyCountProcessor'
# - 'ProjectComplexityProcessor'
# - 'ProjectCognitiveComplexityProcessor'
# - 'ProjectLLOCProcessor'
# - 'ProjectCLOCProcessor'
# - 'ProjectLOCProcessor'
# - 'ProjectSLOCProcessor'
# - 'LicenseHeaderLoaderExtension'
Atul Gupta
05/18/2023, 6:08 PMAbsentOrWrongFileLicense
rule uses UserDataHolder
. Can it be the case that UserDataHolder
doesn't work inside a convention plugin?Atul Gupta
05/18/2023, 7:52 PMprocessors:
active: false