From: Štěpán Balážik Date: Tue, 27 Jan 2026 19:39:17 +0000 (+0100) Subject: Centralize Python tooling configuration in pyproject.toml X-Git-Tag: v9.21.19~15^2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=601fc1f1cf8a1289b5bd0e6621a893af4785914b;p=thirdparty%2Fbind9.git Centralize Python tooling configuration in pyproject.toml This allows easy running of the tools from the project root both in CI and locally. --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35854bbc079..6710a32558f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -669,7 +669,7 @@ vulture: <<: *quick_checks_job <<: *python_triggering_rules script: - - vulture --exclude "*ans.py,conftest.py,re_compile_checker.py,isctest" --ignore-names "after_servers_start,bootstrap,pytestmark,autouse_*" bin/tests/system/ + - vulture ci-variables: <<: *quick_checks_job @@ -767,12 +767,8 @@ doctest: pylint: <<: *quick_checks_job <<: *python_triggering_rules - variables: - PYTHONPATH: "${CI_PROJECT_DIR}/bin/tests/system" script: - - pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py|^bin/tests/system/|^contrib/)') - # Ignore Pylint wrong-import-position error in system test to enable use of pytest.importorskip - - pylint --rcfile $CI_PROJECT_DIR/.pylintrc --load-plugins re_compile_checker --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE '(ans\.py|vulture_ignore_list\.py)') + - pylint $(git ls-files '*.py') reuse: <<: *quick_checks_job diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 3fb33f3c9cc..00000000000 --- a/.pylintrc +++ /dev/null @@ -1,28 +0,0 @@ -[IMPORTS] - -deprecated-modules= - dns.resolver, - -[MESSAGES CONTROL] - -disable= - C0103, # invalid-name - C0114, # missing-module-docstring - C0115, # missing-class-docstring - C0116, # missing-function-docstring - C0209, # consider-using-f-string - C0301, # line-too-long, handled better by black - C0302, # too-many-lines - C0415, # import-outside-toplevel - R0801, # duplicate-code - R0901, # too-many-ancestors - R0902, # too-many-instance-attributes - R0903, # too-few-public-methods - R0904, # too-many-public-methods - R0911, # too-many-return-statements - R0912, # too-many-branches - R0913, # too-many-arguments - R0914, # too-many-locals - R0915, # too-many-statements - R0916, # too-many-boolean-expressions - R0917, # too-many-positional-arguments diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000000..65ce8ba341d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,73 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +[tool.pylint.imports] +deprecated-modules = [ + "dns.resolver", +] +[tool.pylint.messages_control] +disable = [ + "C0103", # invalid-name + "C0209", # consider-using-f-string + "C0114", # missing-module-docstring + "C0115", # missing-class-docstring + "C0116", # missing-function-docstring + "C0301", # line-too-long, handled better by black + "C0302", # too-many-lines + "C0415", # import-outside-toplevel + "R0801", # duplicate-code + "R0901", # too-many-ancestors + "R0902", # too-many-instance-attributes + "R0903", # too-few-public-methods + "R0904", # too-many-public-methods + "R0911", # too-many-return-statements + "R0912", # too-many-branches + "R0913", # too-many-arguments + "R0914", # too-many-locals + "R0915", # too-many-statements + "R0916", # too-many-boolean-expressions + "R0917", # too-many-positional-arguments +] +[tool.pylint.main] +ignore-paths = [ + ".git", + "bin/tests/system/vulture_ignore_list.py", + "contrib", + "dangerfile.py", + "doc", +] +ignore-patterns = [ + "^.*_tmp_.*\\.py$", +] +init-hook = "import sys; sys.path.append('bin/tests/system')" +load-plugins = [ + "re_compile_checker", +] +source-roots = [ + "bin/tests/system/", +] + +[tool.vulture] +paths = [ + "bin/tests/system/", +] +exclude = [ + "*ans.py", + "conftest.py", + "re_compile_checker.py", + "isctest", +] +ignore_names = [ + "after_servers_start", + "bootstrap", + "pytestmark", + "autouse_*", +]