feat: raise "assignment similar to the default"
enhancement
### 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
```nix
{ lib, ... }:
{
options.key = lib.mkOption { };
config.key = lib.mkDefault "value";
}
```
##### consumer (explicitly and redundantly assigning its default value)
```nix
{
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
```nix
{ lib, ... }:
{
options.key = lib.mkOption { };
config.key = lib.mkDefault "value";
}
```
##### consumer (explicitly and redundantly assigning its default value)
```nix
{
key = "value"; # INFO / WARN: key `key` assignment `"value"` similar to its default
}
```
### Describe alternatives you've considered
_No response_
### Additional context
- [ ] #693 (the internal defaults evaluation will be shared)
0 条评论