diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 645ea7d4..a6a56cc5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ exclude: | )$ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.0.291" + rev: "v0.1.9" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -35,7 +35,7 @@ repos: - prettier-plugin-toml - prettier-plugin-sort-json - repo: https://github.com/pre-commit/pre-commit-hooks.git - rev: v4.4.0 + rev: v4.5.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -51,23 +51,23 @@ repos: - id: debug-statements language_version: python3 - repo: https://github.com/codespell-project/codespell - rev: v2.2.5 + rev: v2.2.6 hooks: - id: codespell - repo: https://github.com/adrienverge/yamllint.git - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint files: \.(yaml|yml)$ types: [file, yaml] entry: yamllint --strict - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.12.1 hooks: - id: black language_version: python3 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.8.0 hooks: - id: mypy # empty args needed in order to match mypy cli behavior @@ -84,7 +84,7 @@ repos: - types-pkg_resources - types-jsonschema>=4.4.9 - repo: https://github.com/pycqa/pylint - rev: v3.0.0b0 + rev: v3.0.3 hooks: - id: pylint additional_dependencies: @@ -117,4 +117,5 @@ repos: rev: v1.2.0 hooks: - id: validate-config-in-container + name: packit alias: packit diff --git a/.vscode/settings.json b/.vscode/settings.json index d9cc730e..990033df 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,9 +4,9 @@ }, "[python]": { "editor.codeActionsOnSave": { - "source.fixAll": true, - "source.fixAll.ruff": false, - "source.organizeImports": false + "source.fixAll": "explicit", + "source.fixAll.ruff": "never", + "source.organizeImports": "never" } }, "editor.formatOnSave": true, diff --git a/codecov.yml b/codecov.yml index 9eca5046..09be167e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -4,5 +4,3 @@ comment: false coverage: status: patch: false - project: - threshold: 0.5% diff --git a/src/ansible_compat/runtime.py b/src/ansible_compat/runtime.py index e2cd5e97..985861a0 100644 --- a/src/ansible_compat/runtime.py +++ b/src/ansible_compat/runtime.py @@ -435,7 +435,7 @@ def install_collection( if isinstance(collection, Path): collection = str(collection) # As ansible-galaxy install is not able to automatically determine - # if the range requires a pre-release, we need to manuall add the --pre + # if the range requires a pre-release, we need to manually add the --pre # flag when needed. matches = version_re.search(collection) @@ -621,7 +621,7 @@ def prepare_environment( # noqa: C901 f"{destination}/ansible_collections/{colpath_from_path(Path.cwd())}", ) if colpath.is_symlink(): - if os.path.realpath(colpath) == Path.cwd(): + if os.path.realpath(colpath) == str(Path.cwd()): _logger.warning( "Found symlinked collection, skipping its installation.", ) @@ -741,7 +741,7 @@ def _prepare_ansible_paths(self) -> None: msg = "Unexpected ansible configuration" raise RuntimeError(msg) from exc - alterations_list = [ + alterations_list: list[tuple[list[str], str, bool]] = [ (library_paths, "plugins/modules", True), (roles_path, "roles", True), ] @@ -762,7 +762,7 @@ def _prepare_ansible_paths(self) -> None: if must_be_present: continue path.mkdir(parents=True, exist_ok=True) - if path not in path_list: + if str(path) not in path_list: path_list.insert(0, str(path)) if library_paths != self.config.DEFAULT_MODULE_PATH: @@ -910,7 +910,10 @@ def _get_galaxy_role_ns(galaxy_infos: dict[str, Any]) -> str: def _get_galaxy_role_name(galaxy_infos: dict[str, Any]) -> str: """Compute role name from meta/main.yml.""" - return galaxy_infos.get("role_name", "") + result = galaxy_infos.get("role_name", "") + if not isinstance(result, str): + return "" + return result def search_galaxy_paths(search_dir: Path) -> list[str]: