Skip to content

Commit

Permalink
Merge pull request #386 from phip1611/flake8
Browse files Browse the repository at this point in the history
hooks: flake8: add settings to extend the ignore list
  • Loading branch information
domenkozar authored Jan 10, 2024
2 parents 1e9287e + fbc317b commit b026563
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,13 @@ in
"''${pkgs.python39Packages.flake8}/bin/flake8"
'';
};

extendIgnore =
mkOption {
type = types.listOf types.str;
description = lib.mdDoc "List of additional ignore codes";
default = [ ];
example = [ "E501" ];
};
format =
mkOption {
type = types.str;
Expand Down Expand Up @@ -1341,10 +1347,16 @@ in
files = "${settings.eslint.extensions}";
};
flake8 =
let
extendIgnoreStr =
if lib.lists.length settings.flake8.extendIgnore > 0
then "--extend-ignore " + builtins.concatStringsSep "," settings.flake8.extendIgnore
else "";
in
{
name = "flake8";
description = "Check the style and quality of Python files.";
entry = "${settings.flake8.binPath} --format ${settings.flake8.format}";
entry = "${settings.flake8.binPath} --format ${settings.flake8.format} ${extendIgnoreStr}";
types = [ "python" ];
};
flynt =
Expand Down

0 comments on commit b026563

Please sign in to comment.