From 076aab587bdb0ef208a589e2e5e39a17afa7be84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Linke=C5=A1?= Date: Thu, 26 Oct 2023 15:37:27 +0200 Subject: [PATCH] fix: pydocstyle ignore parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pydocstyle "ignore_decorators" configuration throws an error because we pass a string to pydocstyle's ConventionChecker.check_source() when it expects a regular expression object. Signed-off-by: Juraj Linkeš --- pylama/lint/pylama_pydocstyle.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pylama/lint/pylama_pydocstyle.py b/pylama/lint/pylama_pydocstyle.py index 8af255e..eec47d0 100644 --- a/pylama/lint/pylama_pydocstyle.py +++ b/pylama/lint/pylama_pydocstyle.py @@ -1,6 +1,7 @@ """pydocstyle support.""" from argparse import ArgumentParser +from re import compile from pydocstyle import ConventionChecker as PyDocChecker from pydocstyle.violations import conventions @@ -30,10 +31,11 @@ def run_check(self, ctx: RunContext): # noqa if options and options.pydocstyle_convention: params.setdefault("convention", options.pydocstyle_convention) convention_codes = conventions.get(params.get("convention")) + ignore_decorators_param = params.get("ignore_decorators") for err in PyDocChecker().check_source( ctx.source, ctx.filename, - params.get("ignore_decorators"), + compile(ignore_decorators_param) if ignore_decorators_param is not None else None, params.get("ignore_inline_noqa", False), ): if convention_codes is None or err.code in convention_codes: