Skip to content

feat: raise "assignment similar to the default" #834

Description

@Malix-Labs

Is your feature request related to a problem? Please describe.

Relying on sane defaults might be desirable for some users

And explicitly assigning a key to a value already being its default is not relying on that sane default

Example:

module
{ lib, ... }:
{
  options.key = lib.mkOption { };

  config.key = lib.mkDefault "value";
}
consumer (explicitly and redundantly assigning its default value)
{
  key = "value";
}

Hence, it might be interesting to raise (info / warn) when an assignment is similar to the default

Describe the solution you'd like

Raise (info / warn) when an assignment is similar to the default

module
{ lib, ... }:
{
  options.key = lib.mkOption { };

  config.key = lib.mkDefault "value";
}
consumer (explicitly and redundantly assigning its default value)
{
  key = "value"; # INFO / WARN: key `key` assignment `"value"` similar to its default
}

Describe alternatives you've considered

No response

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions