Centralize Python tooling configuration in pyproject.toml

This allows easy running of the tools from the project root both in CI
and locally.
This commit is contained in:
Štěpán Balážik 2026-01-27 20:39:17 +01:00
parent 4253d7298c
commit 601fc1f1cf
3 changed files with 75 additions and 34 deletions

View file

@ -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

View file

@ -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

73
pyproject.toml Normal file
View file

@ -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_*",
]