Skip to content

Warn on unused settings (or tasks) when they are marked secondary #3183

@eed3si9n

Description

@eed3si9n

problem

  1. sbt will silently ignore unused settings.
  2. Displaying warning for all unused tasks and setting will catch top level keys like clean.
scalacOptions in compile += "-X"

expectation

  1. I can mark keys to be top level or secondary. (keyUsage in (ThisBuild, foo) := Usage.Secondary, probably tasks default to top level, and settings default to secondary.)
  2. There's a buildLint command that warns on unused setting/task expressions with secondary keys provided by build.sbt.
  3. The warning takes in account of the scope delegation rules.
  4. Debug mode to display unused setting/task expressions provided by plugins, including the Defaults.
scalacOptions in compile += "-X"
^ 
[warning] Unused key: projA/*:compile::scalacOptions was not referenced by other settings/tasks.

notes

Many have brought up the idea of warning on unused. Here's previous thread on unused settings from 2011, which shows 58 unused settings.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions