treewide: apply linter suggestions

This commit is contained in:
Gaetan Lepage 2025-12-26 15:06:14 +01:00 committed by Austin Horstman
parent aca6fcdaff
commit 1d333fc92e
39 changed files with 54 additions and 59 deletions

View file

@ -27,7 +27,7 @@ let
# Recurse into all directories, extracting files as we find them.
# This returns a list of { name; file; cases; } attrsets.
fetchTests =
path: namespace:
testPath: namespace:
let
# Handle an entry from readDir
# - If it is a regular nix file, import its content
@ -35,7 +35,7 @@ let
handleEntry =
name: type:
let
file = /${path}/${name};
file = /${testPath}/${name};
in
if type == "regular" then
lib.optional (lib.hasSuffix ".nix" name) (
@ -46,7 +46,7 @@ let
else
fetchTests file (namespace ++ [ name ]);
in
lib.pipe path [
lib.pipe testPath [
builtins.readDir
(lib.filterAttrs (n: v: v != "symlink"))
(lib.mapAttrsToList handleEntry)

View file

@ -29,7 +29,7 @@ let
let
missingFromPkgs = builtins.concatMap (
loc: lib.optional (!lib.hasAttrByPath loc pkgs) (lib.concatStringsSep "." loc)
) (builtins.map lib.toList packages);
) (map lib.toList packages);
undeclared = lib.filter (name: !(lib.elem name declared)) generated;
uselesslyDeclared = lib.partition (name: lib.elem name unsupported) (
lib.filter (name: !(lib.elem name generated)) declared

View file

@ -564,7 +564,7 @@ else
runCommandLocal "lib-tests-failure"
{
results = lib.concatStringsSep "\n" (
builtins.map (result: ''
map (result: ''
${result.name}:
expected: ${lib.generators.toPretty { } result.expected}
result: ${lib.generators.toPretty { } result.result}

View file

@ -45,7 +45,7 @@ let
configuration.config.build.test.overrideAttrs (old: {
passthru =
old.passthru or { }
// builtins.removeAttrs configuration [
// removeAttrs configuration [
"_type"
"type"
]
@ -66,7 +66,7 @@ let
config = import ../example.nix { inherit pkgs; };
in
{
main = builtins.removeAttrs config.programs.nixvim [
main = removeAttrs config.programs.nixvim [
# This is not available to standalone modules, only HM & NixOS Modules
"enable"
# This is purely an example, it does not reflect a real usage

View file

@ -1,14 +1,12 @@
{
lib,
nixpkgsLib,
runCommandLocal,
}:
let
inherit (lib) attrNames filter length;
nixvimList = import ../lib/maintainers.nix;
nixpkgsList = nixpkgsLib.maintainers;
duplicates = filter (name: nixpkgsList ? ${name}) (attrNames nixvimList);
count = length duplicates;
duplicates = builtins.filter (name: nixpkgsList ? ${name}) (builtins.attrNames nixvimList);
count = builtins.length duplicates;
in
runCommandLocal "maintainers-test" { inherit count duplicates; } ''
if [ $count -gt 0 ]; then

View file

@ -11,7 +11,7 @@
# toolOptions is an attrsets of the form:
# { <lang> = { linter = tools; formatter = tools; }; }
# Where tools is the option type representing the valid tools for this language
toolOptions = builtins.removeAttrs (languages.type.getSubOptions languages.loc) [
toolOptions = removeAttrs (languages.type.getSubOptions languages.loc) [
"_freeformOptions"
"_module"