From a2cdf5d8cd2bd37d7e57f2bb2c8c4add89668a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Bal=C3=A1=C5=BEik?= Date: Wed, 28 Jan 2026 17:08:44 +0100 Subject: [PATCH] Lint code in doc directory Adjust ignore lists of linters to check more code. (cherry picked from commit 0fb7403ef42d3a795bb21ca3c481e139491384bb) --- doc/arm/_ext/iscconf.py | 4 ++-- pyproject.toml | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/doc/arm/_ext/iscconf.py b/doc/arm/_ext/iscconf.py index 4313194119..06ade14269 100644 --- a/doc/arm/_ext/iscconf.py +++ b/doc/arm/_ext/iscconf.py @@ -355,7 +355,7 @@ def domain_factory(domainname, domainlabel, todolist, grammar): ) def get_statement_name(self, signature): - return "{}.{}.{}".format(domainname, "statement", signature) + return f"{domainname}.statement.{signature}" def add_statement(self, signature, tags, short, short_node, lineno): """ @@ -363,7 +363,7 @@ def domain_factory(domainname, domainlabel, todolist, grammar): No visible effect. """ name = self.get_statement_name(signature) - anchor = "{}-statement-{}".format(domainname, signature) + anchor = f"{domainname}-statement-{signature}" new = { "tags": tags, diff --git a/pyproject.toml b/pyproject.toml index 60e51cebbe..9946ac8df8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,21 +38,27 @@ disable = [ [tool.pylint.main] ignore-paths = [ ".git", + # Temporary directories created by the system test runner + # (see bin/tests/system/conftest.py:system_test_dir) + "bin/tests/system/.*_tmp_.*/", "bin/tests/system/vulture_ignore_list.py", "contrib", "dangerfile.py", - "doc", + "doc/arm/conf.py", + "doc/man/conf.py", ] -ignore-patterns = [ - "^.*_tmp_.*\\.py$", + +# Both `init-hook` and `source-roots` are needed to avoid import errors, +# enable plugin loading and calling pylint from CI as `pylint $(git ls-files '*.py')` +init-hook = "import sys; sys.path.extend(('bin/tests/system', 'doc/misc', 'doc/arm/_ext'));" +source-roots = [ + "bin/tests/system", + "doc/misc", + "doc/arm/_ext", ] -init-hook = "import sys; sys.path.append('bin/tests/system')" load-plugins = [ "re_compile_checker", ] -source-roots = [ - "bin/tests/system/", -] [tool.vulture] paths = [ @@ -92,5 +98,6 @@ extend-exclude = [ "bin/tests/system/vulture_ignore_list.py", "contrib", "dangerfile.py", - "doc", + "doc/arm/conf.py", + "doc/man/conf.py", ]