Skip to content

Commit

Permalink
Add options for eclint hook
Browse files Browse the repository at this point in the history
  • Loading branch information
totoroot committed Oct 5, 2023
1 parent 1875015 commit da3d9e3
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,38 @@ in
type = types.package;
description = lib.mdDoc "The `eclint` package to use.";
default = "${tools.eclint}";
defaultText = "\${tools.eclint}";
example = "\${pkgs.eclint}";
defaultText = lib.literalExpression "\${tools.eclint}";
example = lib.literalExpression "\${pkgs.eclint}";
};
fix =
mkOption {
type = types.bool;
description = lib.mdDoc "Modify files in place rather than showing the errors.";
default = false;
};
summary =
mkOption {
type = types.bool;
description = lib.mdDoc "Only show number of errors per file.";
default = false;
};
color =
mkOption {
type = types.enum [ "auto" "always" "never" ];
description = lib.mdDoc "When to generate colored output.";
default = "auto";
};
exclude =
mkOption {
type = types.listOf types.str;
description = lib.mdDoc "Filter to exclude files.";
default = [ ];
};
verbosity =
mkOption {
type = types.enum [ 0 1 2 3 4 ];
description = lib.mdDoc "Log level verbosity";
default = 0;
};
};
rome =
Expand Down Expand Up @@ -1500,7 +1530,20 @@ in
{
name = "eclint";
description = "EditorConfig linter written in Go.";
entry = "${settings.eclint.package}/bin/eclint --fix";
types = [ "file" ];
entry =
let
cmdArgs =
mkCmdArgs
(with settings.eclint; [
[ fix "-fix" ]
[ summary "-summary" ]
[ (color != "auto") "-color ${color}" ]
[ (exclude != [ ]) "-exclude ${lib.escapeShellArgs exclude}" ]
[ (verbosity != 0) "-verbosity ${toString verbosity}" ]
]);
in
"${settings.eclint.package}/bin/eclint ${cmdArgs}";
};

rome =
Expand Down

0 comments on commit da3d9e3

Please sign in to comment.