Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: #4705
  • Loading branch information
dbrennand committed Sep 8, 2025
commit 9eea653bf892a8ce21d1e6bf62a7560ba3193ccf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Playbook issue 4705
hosts: localhost
gather_facts: false
tasks:
- name: Debug for 4705
ansible.builtin.debug:
msg: "Hello, World! - This line is far too long and goes over the 111 lines which is allowed by our custom yamllint configuration."
4 changes: 1 addition & 3 deletions src/ansiblelint/rules/yaml_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from ansiblelint.file_utils import Lintable
from ansiblelint.rules import AnsibleLintRule, TransformMixin
from ansiblelint.yaml_utils import load_yamllint_config

if TYPE_CHECKING:
from collections.abc import MutableMapping, MutableSequence
Expand All @@ -29,7 +28,6 @@ class YamllintRule(AnsibleLintRule, TransformMixin):
severity = "VERY_LOW"
tags = ["formatting", "yaml"]
version_changed = "5.0.0"
config = load_yamllint_config()
has_dynamic_tags = True
link = "https://yamllint.readthedocs.io/en/stable/rules.html"
# ensure this rule runs before most of other common rules
Expand Down Expand Up @@ -68,7 +66,7 @@ def matchyaml(self, file: Lintable) -> list[MatchError]:

for problem in run_yamllint( # type: ignore[no-untyped-call]
file.content,
YamllintRule.config,
self._collection.app.yamllint_config,
filepath=file.path,
):
self.severity = "VERY_LOW"
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/yamllint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
rules:
line-length:
max: 222
max: 111
2 changes: 1 addition & 1 deletion test/test_yaml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,4 +1041,4 @@ def test_yamllint_file_config_loaded() -> None:
"""Ensure the yamllint configuration from a file is loaded correctly."""
config_fixture = Path(fixtures_dir / "yamllint.yml")
config = ansiblelint.yaml_utils.load_yamllint_config(yamllint_file=config_fixture)
assert config.rules["line-length"]["max"] == 222
assert config.rules["line-length"]["max"] == 111
Loading