refactor(dotfiles): simplify registry validation
This commit is contained in:
@@ -3,17 +3,7 @@
|
||||
lib,
|
||||
}:
|
||||
let
|
||||
assertValid =
|
||||
data:
|
||||
let
|
||||
assertions = validationAssertions data;
|
||||
failures = lib.filter (assertion: !assertion.assertion) assertions;
|
||||
in
|
||||
assert lib.assertMsg (lib.all (assertion: assertion.assertion) assertions) (
|
||||
lib.concatMapStringsSep "\n" (assertion: assertion.message) failures
|
||||
);
|
||||
data;
|
||||
|
||||
# NOLINT(single_use_binding)
|
||||
validationAssertions =
|
||||
data:
|
||||
lib.concatLists (
|
||||
@@ -29,6 +19,7 @@ let
|
||||
) definitions
|
||||
);
|
||||
|
||||
# NOLINT(single_use_binding)
|
||||
flattenRegistryEntries =
|
||||
registryName: data:
|
||||
lib.concatLists (
|
||||
@@ -41,4 +32,13 @@ let
|
||||
) data
|
||||
);
|
||||
in
|
||||
assertValid
|
||||
data:
|
||||
let
|
||||
assertions = validationAssertions data;
|
||||
in
|
||||
assert lib.assertMsg (lib.all (assertion: assertion.assertion) assertions) (
|
||||
lib.concatMapStringsSep "\n" (assertion: assertion.message) (
|
||||
lib.filter (assertion: !assertion.assertion) assertions
|
||||
)
|
||||
);
|
||||
data
|
||||
|
||||
Reference in New Issue
Block a user