Skip to content

Commit c9fd910

Browse files
authored
Update linters (#3870)
1 parent 824d58f commit c9fd910

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ repos:
6464
- prettier-plugin-toml
6565
- prettier-plugin-sort-json
6666
- repo: https://github.com/streetsidesoftware/cspell-cli
67-
rev: v7.3.1
67+
rev: v7.3.2
6868
hooks:
6969
- id: cspell
7070
# entry: codespell --relative
@@ -75,7 +75,7 @@ repos:
7575
hooks:
7676
- id: check-github-workflows
7777
- repo: https://github.com/pre-commit/pre-commit-hooks.git
78-
rev: v4.4.0
78+
rev: v4.5.0
7979
hooks:
8080
- id: end-of-file-fixer
8181
# ignore formatting-prettier to have an accurate prettier comparison
@@ -131,17 +131,17 @@ repos:
131131
types: [file, yaml]
132132
entry: yamllint --strict
133133
- repo: https://github.com/astral-sh/ruff-pre-commit
134-
rev: "v0.0.292"
134+
rev: "v0.1.2"
135135
hooks:
136136
- id: ruff
137137
args: [--fix, --exit-non-zero-on-fix]
138138
- repo: https://github.com/psf/black
139-
rev: 23.9.1
139+
rev: 23.10.1
140140
hooks:
141141
- id: black
142142
language_version: python3
143143
- repo: https://github.com/pre-commit/mirrors-mypy
144-
rev: v1.5.1
144+
rev: v1.6.1
145145
hooks:
146146
- id: mypy
147147
# empty args needed in order to match mypy cli behavior

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ python_files = [
232232
xfail_strict = true
233233

234234
[tool.ruff]
235-
required-version = "0.0.292"
235+
required-version = "0.1.2"
236236
ignore = [
237237
"D203", # incompatible with D211
238238
"D213", # incompatible with D212

src/ansiblelint/schemas/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ def refresh_schemas(min_age_seconds: int = 3600 * 24) -> int:
6868
raise RuntimeError(msg)
6969
path = Path(__file__).parent.resolve() / f"{kind}.json"
7070
_logger.debug("Refreshing %s schema ...", kind)
71-
request = Request(url)
71+
if not url.startswith(("http:", "https:")):
72+
msg = f"Unexpected url schema: {url}"
73+
raise ValueError(msg)
74+
request = Request(url) # noqa: S310
7275
etag = data.get("etag", "")
7376
if etag:
7477
request.add_header("If-None-Match", f'"{data.get("etag")}"')

src/ansiblelint/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,11 @@ class Task(dict[str, Any]):
702702
@property
703703
def name(self) -> str | None:
704704
"""Return the name of the task."""
705-
return self.raw_task.get("name", None)
705+
name = self.raw_task.get("name", None)
706+
if name is not None and not isinstance(name, str):
707+
msg = "Task name can only be a string."
708+
raise RuntimeError(msg)
709+
return name
706710

707711
@property
708712
def action(self) -> str:

0 commit comments

Comments
 (0)