update static plugin #11
|
|
@ -36,11 +36,11 @@ class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
|||
|
||||
override fun createLinters(extension: StaticAnalysisExtension): List<Linter> = mutableListOf<Linter>().apply {
|
||||
add(DetektLinter())
|
||||
if (extension.isCpdLinterEnabled) {
|
||||
CpdLinter()
|
||||
if (extension.needCpdLinterEnabled) {
|
||||
add(CpdLinter())
|
||||
}
|
||||
if (extension.isAndroidLinterEnabled) {
|
||||
AndroidLinter()
|
||||
if (extension.needAndroidLinterEnabled) {
|
||||
add(AndroidLinter())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ package static_analysis.plugins
|
|||
open class StaticAnalysisExtension(
|
||||
var excludes: String = "",
|
||||
var buildScriptDir: String? = null,
|
||||
var isCpdLinterEnabled: Boolean = true,
|
||||
var isAndroidLinterEnabled: Boolean = false,
|
||||
var needCpdLinterEnabled: Boolean = true,
|
||||
var needAndroidLinterEnabled: Boolean = false,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -42,8 +42,24 @@ abstract class StaticAnalysisPlugin : Plugin<Project> {
|
|||
}
|
||||
|
||||
abstract fun createLinters(extension: StaticAnalysisExtension): List<Linter>
|
||||
|
||||
abstract fun createStaticAnalysisTasks(project: Project, linters: List<Linter>)
|
||||
|
||||
/**
|
||||
* Project level
|
||||
*
|
||||
* В gradle.kts используйте этот extension.
|
||||
*
|
||||
* В классическом gradle, синтаксис ровно тот, же, но без использования extension.
|
||||
* ```
|
||||
* staticAnalysis {
|
||||
* excludes = ":name_example"
|
||||
* buildScriptDir = buildScriptsDirectory
|
||||
* needCpdLinterEnabled = false
|
||||
* needAndroidLinterEnabled = false
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
fun Project.staticAnalysis(configure: Action<StaticAnalysisExtension>): Unit =
|
||||
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure(STATIC_ANALYSIS_EXT_NAME, configure)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue