mirror of https://github.com/sbt/sbt.git
Allow lintUnusedKeys to be disabled
The linting can take a while for large projects because `Def.compiled` scales in the number of settings. Even for small projects (i.e. scripted tests), it takes about 50 ms on my computer. This doesn't change the current behavior because the default value is true.
This commit is contained in:
parent
805fa002a7
commit
3bb847fc72
|
|
@ -495,6 +495,7 @@ object Keys {
|
|||
val lintUnused = inputKey[Unit]("Check for keys unused by other settings and tasks.")
|
||||
val excludeLintKeys = settingKey[Set[Def.KeyedInitialize[_]]]("Keys excluded from lintUnused task")
|
||||
val includeLintKeys = settingKey[Set[Def.KeyedInitialize[_]]]("Task keys that are included into lintUnused task")
|
||||
val lintUnusedKeysOnLoad = settingKey[Boolean]("Toggles whether or not to check for unused keys during startup")
|
||||
|
||||
val stateStreams = AttributeKey[Streams]("stateStreams", "Streams manager, which provides streams for different contexts. Setting this on State will override the default Streams implementation.")
|
||||
val resolvedScoped = Def.resolvedScoped
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ object LintUnused {
|
|||
ivyConfiguration,
|
||||
),
|
||||
Keys.lintUnused := lintUnusedTask.evaluated,
|
||||
Keys.lintUnusedKeysOnLoad := true,
|
||||
)
|
||||
|
||||
// input task version of the lintUnused
|
||||
|
|
@ -59,8 +60,10 @@ object LintUnused {
|
|||
val extracted = Project.extract(s)
|
||||
val includeKeys = extracted.get(includeLintKeys in Global) map { _.scopedKey.key.label }
|
||||
val excludeKeys = extracted.get(excludeLintKeys in Global) map { _.scopedKey.key.label }
|
||||
val result = lintUnused(s, includeKeys, excludeKeys)
|
||||
lintResultLines(result) foreach { log.warn(_) }
|
||||
if (extracted.get(lintUnusedKeysOnLoad in Global)) {
|
||||
val result = lintUnused(s, includeKeys, excludeKeys)
|
||||
lintResultLines(result) foreach { log.warn(_) }
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue