Skip to content

Commit

Permalink
chore: pre-commit autoupdate (#4010)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Cristiano Nicolai <570894+cristianonicolai@users.noreply.github.com>
Co-authored-by: Ajinkya Udgirkar <ajinkyaudgirkar@gmail.com>
  • Loading branch information
3 people committed Feb 7, 2024
1 parent 4b36ffa commit a3fc7e4
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ repos:
args: [--relative, --no-progress, --no-summary]
name: Spell check with cspell
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.3
rev: 0.27.4
hooks:
- id: check-github-workflows
- repo: https://github.com/pre-commit/pre-commit-hooks.git
Expand Down Expand Up @@ -136,7 +136,7 @@ repos:
types: [file, yaml]
entry: yamllint --strict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.13"
rev: "v0.2.0"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
1 change: 1 addition & 0 deletions src/ansiblelint/formatters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class BaseFormatter(Generic[T]):
----
base_dir (str|Path): reference directory against which display relative path.
display_relative_path (bool): whether to show path as relative or absolute
"""

def __init__(self, base_dir: str | Path, display_relative_path: bool) -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def create_matcherror(
match_type: str | None = None
while not match_type and frame is not None:
func_name = frame.f_code.co_name
match_type = match_types.get(func_name, None)
match_type = match_types.get(func_name)
if match_type:
# add the match_type to the match
match.match_type = match_type
Expand Down Expand Up @@ -558,7 +558,7 @@ def list_tags(self) -> str:
tags[tag] = list(rule.ids())
result = "# List of tags and rules they cover\n"
for tag in sorted(tags):
desc = tag_desc.get(tag, None)
desc = tag_desc.get(tag)
if desc:
result += f"{tag}: # {desc}\n"
else:
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/rules/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def matchplay(self, file: Lintable, data: dict[str, Any]) -> list[MatchError]:
for path in changelog_paths:
if path.is_file():
changelog_found = 1
galaxy_tag_list = data.get("tags", None)
collection_deps = data.get("dependencies", None)
galaxy_tag_list = data.get("tags")
collection_deps = data.get("dependencies")
if collection_deps:
for dep, ver in collection_deps.items():
if (
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/no_prompting.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def matchplay(self, file: Lintable, data: dict[str, Any]) -> list[MatchError]:
if file.kind != "playbook": # pragma: no cover
return []

vars_prompt = data.get("vars_prompt", None)
vars_prompt = data.get("vars_prompt")
if not vars_prompt:
return []
return [
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/run_once.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def matchplay(self, file: Lintable, data: dict[str, Any]) -> list[MatchError]:
if not file or file.kind != "playbook" or not data:
return []

strategy = data.get("strategy", None)
strategy = data.get("strategy")
run_once = data.get("run_once", False)
if (not strategy and not run_once) or strategy != "free":
return []
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/skip_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def get_nested_tasks(task: Any) -> Generator[Any, None, None]:
if not task or not is_nested_task(task):
return
for k in NESTED_TASK_KEYS:
if k in task and task[k]:
if task.get(k):
if hasattr(task[k], "get"):
continue
for subtask in task[k]:
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import logging
import os
import re
from collections.abc import Generator, ItemsView, Iterator, Mapping, Sequence
from collections.abc import ItemsView, Iterator, Mapping, Sequence
from dataclasses import _MISSING_TYPE, dataclass, field
from functools import cache, lru_cache
from pathlib import Path
Expand Down Expand Up @@ -774,7 +774,7 @@ def __getitem__(self, index: str) -> Any:
"""Allow access as task[...]."""
return self.normalized_task[index]

def __iter__(self) -> Generator[str, None, None]:
def __iter__(self) -> Iterator[str]:
"""Provide support for 'key in task'."""
yield from (f for f in self.normalized_task)

Expand Down

0 comments on commit a3fc7e4

Please sign in to comment.