From fbc317bff97af4dc4c9b98b92c1679c125473300 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Wed, 10 Jan 2024 19:29:28 +0100 Subject: [PATCH] hooks: flake8: add settings to extend the ignore list --- modules/hooks.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index 4d112640..ef53d16d 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -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; @@ -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 =