From 57aee5d89e03f6f00bd908a868019840f97557a7 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 15 Jan 2025 13:04:25 +0000 Subject: [PATCH] Update linters and fix constraints --- .config/constraints.txt | 12 ++++++------ .config/pydoclint-baseline.txt | 4 ---- .pre-commit-config.yaml | 4 ++-- .../dependency/ansible_galaxy/collections.py | 3 ++- src/molecule/types.py | 1 + tox.ini | 10 ++++------ 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.config/constraints.txt b/.config/constraints.txt index 6cb49c55e3..a3fa6c9666 100644 --- a/.config/constraints.txt +++ b/.config/constraints.txt @@ -6,7 +6,7 @@ # ansi2html==1.9.2 ansible-compat==24.10.0 -ansible-core==2.18.1 +ansible-core==2.17.7 ansible-lint==24.12.2 astroid==3.3.8 attrs==24.3.0 @@ -36,7 +36,7 @@ dill==0.3.9 distlib==0.3.9 dnspython==2.7.0 docker==7.1.0 -docstring-parser-fork==0.0.10 +docstring-parser-fork==0.0.12 enrich==1.2.7 exceptiongroup==1.2.2 execnet==2.1.1 @@ -65,7 +65,7 @@ mdurl==0.1.2 mergedeep==1.3.4 mkdocs==1.6.1 mkdocs-ansible==24.12.0 -mkdocs-autorefs==1.2.0 +mkdocs-autorefs==1.3.0 mkdocs-gen-files==0.5.0 mkdocs-get-deps==0.2.0 mkdocs-htmlproofer-plugin==1.3.0 @@ -91,7 +91,7 @@ pluggy==1.5.0 pre-commit==4.0.1 ptyprocess==0.7.0 pycparser==2.22 -pydoclint==0.5.16 +pydoclint==0.6.0 pygments==2.19.1 pylint==3.3.3 pymdown-extensions==10.14 @@ -111,10 +111,10 @@ referencing==0.35.1 regex==2024.11.6 regress==2024.11.1 requests==2.32.3 -resolvelib==1.1.0 +resolvelib==1.0.1 rich==13.9.4 rpds-py==0.22.3 -ruamel-yaml==0.18.10 +ruamel-yaml==0.18.7 ruamel-yaml-clib==0.2.12 ruff==0.9.1 six==1.17.0 diff --git a/.config/pydoclint-baseline.txt b/.config/pydoclint-baseline.txt index ee934a3f6d..399cb2b1a4 100644 --- a/.config/pydoclint-baseline.txt +++ b/.config/pydoclint-baseline.txt @@ -55,10 +55,6 @@ tests/fixtures/integration/test_command/scenarios/verifier/molecule/testinfra-pr DOC107: Function `test_ansible_hostname`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints DOC103: Function `test_ansible_hostname`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [host: ]. -------------------- -tests/integration/conftest.py - DOC201: Function `_with_scenario` does not have a return section in docstring - DOC405: Function `_with_scenario` has both "return" and "yield" statements. Please use Generator[YieldType, SendType, ReturnType] as the return type annotation, and put your yield type in YieldType and return type in ReturnType. More details in https://jsh9.github.io/pydoclint/notes_generator_vs_iterator.html --------------------- tests/integration/test_command.py DOC601: Class `ParamDefault`: Class docstring contains fewer class attributes than actual class attributes. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.) DOC603: Class `ParamDefault`: Class docstring attributes are different from actual class attributes. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Attributes in the class definition but not in the docstring: [argnames: tuple[str, str], argvalues: tuple[tuple[str, str]], ids: str, indirect: tuple[str, str]]. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac855bb0be..0e05f41674 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,7 +59,7 @@ repos: - id: tox-ini-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.1 hooks: - id: ruff args: @@ -72,7 +72,7 @@ repos: name: Spell check with cspell - repo: https://github.com/jsh9/pydoclint - rev: "0.5.14" + rev: "0.6.0" hooks: - id: pydoclint # This allows automatic reduction of the baseline file when needed. diff --git a/src/molecule/dependency/ansible_galaxy/collections.py b/src/molecule/dependency/ansible_galaxy/collections.py index 0fb5841170..6c2bf53828 100644 --- a/src/molecule/dependency/ansible_galaxy/collections.py +++ b/src/molecule/dependency/ansible_galaxy/collections.py @@ -1,3 +1,4 @@ +# noqa: A005 """Ansible Galaxy dependencies for lists of collections.""" from __future__ import annotations @@ -58,4 +59,4 @@ def requirements_file(self) -> str: Returns: Path to the requirements file for this dependency. """ - return cast(str, self.options["requirements-file"]) + return cast("str", self.options["requirements-file"]) diff --git a/src/molecule/types.py b/src/molecule/types.py index 6a59f6a3e9..091b6e531e 100644 --- a/src/molecule/types.py +++ b/src/molecule/types.py @@ -1,3 +1,4 @@ +# noqa: A005 """Assorted convenience types for molecule.""" from __future__ import annotations diff --git a/tox.ini b/tox.ini index 35a365f58f..e0212fd412 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,10 @@ pass_env = TERM USER set_env = - !milestone: PIP_CONSTRAINT = {toxinidir}/.config/constraints.txt + PIP_CONSTRAINT={toxinidir}/.config/constraints.txt + UV_BUILD_CONSTRAINT={toxinidir}/.config/constraints.txt + milestone,lint,deps: PIP_CONSTRAINT=/dev/null + milestone,lint,deps: UV_BUILD_CONSTRAINT=/dev/null COVERAGE_COMBINED = {envdir}/.coverage COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}} COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml @@ -56,8 +59,6 @@ skip_install = true deps = {[testenv:lint]deps} extras = -set_env = - PIP_CONSTRAINT = /dev/null commands_pre = commands = -pre-commit run --all-files --show-diff-on-failure --hook-stage manual deps @@ -84,8 +85,6 @@ deps = pip pre-commit>=4.0.1 pre-commit-uv>=4.1.4 -set_env = - PIP_CONSTRAINT = /dev/null commands = pre-commit run --show-diff-on-failure --all-files @@ -96,7 +95,6 @@ deps = ansible-core@ https://github.com/ansible/ansible/archive/milestone.tar.gz set_env = {[testenv]set_env} - PIP_CONSTRAINT = /dev/null [testenv:pkg] description =