tests: remove special case for efmls-configs

This commit is contained in:
Matt Sturgeon 2024-08-22 11:31:57 +01:00
parent 06419627e2
commit 087f70cb0a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 95 additions and 98 deletions

View file

@ -41,21 +41,8 @@ let
testsList = lib.lists.flatten (parseDirectories root [ ]); testsList = lib.lists.flatten (parseDirectories root [ ]);
testsListEvaluated = builtins.map ( testsListEvaluated = builtins.map (
{ cases, namespace }@args: { cases, ... }@args:
if builtins.isAttrs cases then if builtins.isFunction cases then args // { cases = cases { inherit pkgs lib helpers; }; } else args
args
else
{
# cases is a function
cases = cases {
inherit pkgs helpers;
efmls-options = import ../plugins/lsp/language-servers/efmls-configs.nix {
inherit pkgs lib helpers;
config = { };
};
};
inherit namespace;
}
) testsList; ) testsList;
# Take a list of test cases (i.e the content of a file) and prepare a test case that can be # Take a list of test cases (i.e the content of a file) and prepare a test case that can be

View file

@ -1,93 +1,103 @@
{ efmls-options, pkgs, ... }:
{ {
empty = { empty = {
plugins.efmls-configs.enable = true; plugins.efmls-configs.enable = true;
}; };
all = { all =
plugins.efmls-configs = {
let lib,
options = efmls-options.options.plugins.efmls-configs; options,
# toolOptions is an attrsets of the form: pkgs,
# { <lang> = { linter = tools; formatter = tools; }; } ...
# Where tools is the option type representing the valid tools for this language }:
toolOptions = (builtins.head options.setup.type.getSubModules).options; let
inherit (pkgs.stdenv.hostPlatform) system;
inherit (options.plugins.efmls-configs) setup;
brokenTools = # toolOptions is an attrsets of the form:
[ # { <lang> = { linter = tools; formatter = tools; }; }
# Broken as of 2024-07-08 # Where tools is the option type representing the valid tools for this language
# TODO: re-enable this tests when fixed toolOptions = builtins.removeAttrs (setup.type.getSubOptions setup.loc) [
"cpplint" "_freeformOptions"
] "_module"
++ pkgs.lib.optionals (pkgs.stdenv.hostPlatform.system == "aarch64-linux") [ ];
# Broken as of 2024-07-13
# TODO: re-enable this tests when fixed
"textlint"
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
# As of 2024-01-04, texliveMedium is broken on darwin
# TODO: re-enable those tests when fixed
"chktex"
"latexindent"
]
++ pkgs.lib.optionals (pkgs.stdenv.hostPlatform.system == "x86_64-darwin") [
# As of 2024-07-31, dmd is broken on x86_64-darwin
# https://github.com/NixOS/nixpkgs/pull/331373
# TODO: re-enable this test when fixed
"dmd"
# As of 2024-01-04, luaformat is broken on x86_64-darwin
# TODO: re-enable this test when fixed
"lua_format"
];
unpackaged = brokenTools =
[ [
"blade_formatter" # Broken as of 2024-07-08
"cspell" # TODO: re-enable this tests when fixed
"cljstyle" "cpplint"
"dartanalyzer" ]
"debride" ++ lib.optionals (system == "aarch64-linux") [
"deno_fmt" # Broken as of 2024-07-13
"fecs" # TODO: re-enable this tests when fixed
"fixjson" "textlint"
"forge_fmt" ]
"gersemi" ++ lib.optionals pkgs.stdenv.isDarwin [
"js_standard" # As of 2024-01-04, texliveMedium is broken on darwin
"pint" # TODO: re-enable those tests when fixed
"prettier_eslint" "chktex"
"prettier_standard" "latexindent"
"redpen" ]
"reek" ++ lib.optionals (system == "x86_64-darwin") [
"rome" # As of 2024-07-31, dmd is broken on x86_64-darwin
"slim_lint" # https://github.com/NixOS/nixpkgs/pull/331373
"solhint" # TODO: re-enable this test when fixed
"sorbet" "dmd"
"swiftformat" # As of 2024-01-04, luaformat is broken on x86_64-darwin
"swiftlint" # TODO: re-enable this test when fixed
"xo" "lua_format"
] ];
++ (pkgs.lib.optionals pkgs.stdenv.isDarwin [ "clazy" ])
++ (pkgs.lib.optionals pkgs.stdenv.isAarch64 [
"dmd"
"smlfmt"
]);
# Fetch the valid enum members from the tool options unpackaged =
toolsFromOptions = [
opt: "blade_formatter"
let "cspell"
# tool options are a `either toolType (listOf toolType)` "cljstyle"
# Look into `nestedTypes.left` to get a `toolType` option. "dartanalyzer"
toolType = opt.type.nestedTypes.left; "debride"
# toolType is a `either (enum possible) helpers.nixvimTypes.rawLua "deno_fmt"
# Look into `nestedTypes.left` for the enum "fecs"
possible = toolType.nestedTypes.left; "fixjson"
# possible is an enum, look into functor.payload for the variants "forge_fmt"
toolList = possible.functor.payload; "gersemi"
in "js_standard"
builtins.filter (t: !builtins.elem t (brokenTools ++ unpackaged)) toolList; "pint"
in "prettier_eslint"
{ "prettier_standard"
"redpen"
"reek"
"rome"
"slim_lint"
"solhint"
"sorbet"
"swiftformat"
"swiftlint"
"xo"
]
++ lib.optionals pkgs.stdenv.isDarwin [ "clazy" ]
++ lib.optionals pkgs.stdenv.isAarch64 [
"dmd"
"smlfmt"
];
# Fetch the valid enum members from the tool options
toolsFromOptions =
opt:
let
# tool options are a `either toolType (listOf toolType)`
# Look into `nestedTypes.left` to get a `toolType` option.
toolType = opt.type.nestedTypes.left;
# toolType is a `either (enum possible) helpers.nixvimTypes.rawLua
# Look into `nestedTypes.left` for the enum
possible = toolType.nestedTypes.left;
# possible is an enum, look into functor.payload for the variants
toolList = possible.functor.payload;
in
builtins.filter (t: !builtins.elem t (brokenTools ++ unpackaged)) toolList;
in
{
plugins.efmls-configs = {
enable = true; enable = true;
# Replace the { <lang> = { linter = tools; formatter = tools; } }; # Replace the { <lang> = { linter = tools; formatter = tools; } };
@ -97,7 +107,7 @@
# };} # };}
setup = builtins.mapAttrs (_: builtins.mapAttrs (_: toolsFromOptions)) toolOptions; setup = builtins.mapAttrs (_: builtins.mapAttrs (_: toolsFromOptions)) toolOptions;
}; };
}; };
example = { example = {
extraConfigLuaPre = '' extraConfigLuaPre = ''