treewide: apply linter suggestions
This commit is contained in:
parent
aca6fcdaff
commit
1d333fc92e
39 changed files with 54 additions and 59 deletions
|
|
@ -6,7 +6,7 @@
|
|||
docsUrl ? "https://nix-community.github.io/nixvim/",
|
||||
}:
|
||||
src:
|
||||
runCommand (src.name or (builtins.baseNameOf src))
|
||||
runCommand (src.name or (baseNameOf src))
|
||||
{
|
||||
inherit src;
|
||||
bindings =
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ let
|
|||
builtins.concatMap (
|
||||
node:
|
||||
let
|
||||
children = builtins.removeAttrs node [ "_page" ];
|
||||
children = removeAttrs node [ "_page" ];
|
||||
in
|
||||
lib.optional (node ? _page) node._page ++ lib.optionals (children != { }) (collectPages children)
|
||||
) (builtins.attrValues (builtins.removeAttrs pages [ "_category" ]));
|
||||
) (builtins.attrValues (removeAttrs pages [ "_category" ]));
|
||||
|
||||
# Normalised page specs
|
||||
pageList = collectPages pages;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ let
|
|||
value =
|
||||
let
|
||||
file = removeNixvimPrefix location.file;
|
||||
line = builtins.toString location.line;
|
||||
line = toString location.line;
|
||||
text = "${file}:${line}";
|
||||
target = "${urlPrefix}/${file}#L${line}";
|
||||
in
|
||||
|
|
@ -80,6 +80,6 @@ lib.pipe functionSet [
|
|||
# No need to include out-of-tree entries
|
||||
(builtins.filter (entry: lib.strings.hasPrefix rootPathString entry.location.file))
|
||||
# Convert entries to attrset
|
||||
(builtins.map entryToNameValuePair)
|
||||
(map entryToNameValuePair)
|
||||
builtins.listToAttrs
|
||||
]
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ let
|
|||
# whether to nest into a sub-page, so that we can keep the original
|
||||
# _freeformOptions attr as intended.
|
||||
attrs._freeformOptions or { }
|
||||
// builtins.removeAttrs attrs [
|
||||
// removeAttrs attrs [
|
||||
"_module"
|
||||
"_freeformOptions"
|
||||
"warnings"
|
||||
|
|
@ -96,7 +96,7 @@ let
|
|||
let
|
||||
info = lib.attrByPath path { } nixvimInfo;
|
||||
maintainers = lib.unique (configuration.config.meta.maintainers.${info.file} or [ ]);
|
||||
maintainersNames = builtins.map maintToMD maintainers;
|
||||
maintainersNames = map maintToMD maintainers;
|
||||
maintToMD = m: if m ? github then "[${m.name}](https://github.com/${m.github})" else m.name;
|
||||
in
|
||||
# Make sure this path has a valid info attrset
|
||||
|
|
@ -304,7 +304,7 @@ let
|
|||
|
||||
# Attrset of { filePath = renderedDocs; }
|
||||
platformOptionsFiles = lib.listToAttrs (
|
||||
builtins.map (
|
||||
map (
|
||||
{ path, file, ... }:
|
||||
{
|
||||
name = path;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ let
|
|||
modules = [ ./page.nix ];
|
||||
};
|
||||
|
||||
pages = builtins.removeAttrs config (builtins.attrNames options);
|
||||
pages = removeAttrs config (builtins.attrNames options);
|
||||
in
|
||||
{
|
||||
freeformType = lib.types.attrsOf pageType;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ let
|
|||
modules = [ ./category.nix ];
|
||||
};
|
||||
|
||||
categories = builtins.removeAttrs config (builtins.attrNames options);
|
||||
categories = removeAttrs config (builtins.attrNames options);
|
||||
in
|
||||
{
|
||||
freeformType = lib.types.attrsOf categoryType;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ let
|
|||
nextPrefix = if showInMenu then loc else prefix;
|
||||
nextIndent = if showInMenu && nested then indent + " " else indent;
|
||||
|
||||
children = builtins.removeAttrs page optionNames;
|
||||
children = removeAttrs page optionNames;
|
||||
submenu = lib.pipe children [
|
||||
builtins.attrValues
|
||||
(map (
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
drv, # The derivation under test
|
||||
}:
|
||||
let
|
||||
toFile = name: v: if lib.isPath v then v else writeText name v;
|
||||
mkFile = name: v: if lib.isPath v then v else writeText name v;
|
||||
|
||||
overrideSrc =
|
||||
src:
|
||||
|
|
@ -21,8 +21,8 @@ let
|
|||
}:
|
||||
testers.testEqualContents {
|
||||
assertion = message;
|
||||
actual = overrideSrc (toFile "${message}-input" input);
|
||||
expected = toFile "${message}-expected" expected;
|
||||
actual = overrideSrc (mkFile "${message}-input" input);
|
||||
expected = mkFile "${message}-expected" expected;
|
||||
};
|
||||
in
|
||||
# TODO: introduce some negative cases for input that should fail
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ You could use the builtin [`map`] function (or similar) to do something like thi
|
|||
```nix
|
||||
{
|
||||
keymaps =
|
||||
(builtins.map (key: {
|
||||
(map (key: {
|
||||
inherit key;
|
||||
action = "<some-action>";
|
||||
options.desc = "My cool keymapping";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue