statix: enable useless_has_attr

Enable statix's useless_has_attr rule and apply its auto-fixes across the affected modules.
This commit is contained in:
Austin Horstman
2026-04-08 15:41:49 -05:00
parent 5209a256fd
commit 11ad9d2e42
4 changed files with 4 additions and 10 deletions

View File

@@ -94,10 +94,8 @@ in
# Get the blocks if successful, abort if not
blocks =
if trySortedBlocks ? result then
trySortedBlocks.result
else
abort "Dependency cycle in i3blocks: ${builtins.toJSON trySortedBlocks}";
trySortedBlocks.result
or (abort "Dependency cycle in i3blocks: ${builtins.toJSON trySortedBlocks}");
# Turn the blocks back into their name value pairs
orderedBlocks = (map (value: (nameValuePairToAttr (dagEntryToNameValue value))) blocks);

View File

@@ -616,10 +616,7 @@ in
sortedMatchBlocks = lib.hm.dag.topoSort (lib.removeAttrs cfg.matchBlocks [ "*" ]);
sortedMatchBlocksStr = builtins.toJSON sortedMatchBlocks;
matchBlocks =
if sortedMatchBlocks ? result then
sortedMatchBlocks.result
else
abort "Dependency cycle in SSH match blocks: ${sortedMatchBlocksStr}";
sortedMatchBlocks.result or (abort "Dependency cycle in SSH match blocks: ${sortedMatchBlocksStr}");
defaultHostBlock = cfg.matchBlocks."*" or null;
in

View File

@@ -337,7 +337,7 @@ let
};
};
};
defaultProfile = if cfg.profiles ? default then cfg.profiles.default else { };
defaultProfile = cfg.profiles.default or { };
allProfilesExceptDefault = removeAttrs cfg.profiles [ "default" ];
in
{

View File

@@ -13,6 +13,5 @@ disabled = [
"repeated_keys",
"redundant_pattern_bind",
"unquoted_uri",
"useless_has_attr",
"useless_parens",
]