Skip to content

Commit 375c2e3

Browse files
authored
search for config with the yml/yaml extension (#4416)
1 parent a5fbd7c commit 375c2e3

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

docs/configuring.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ the one specified inside the configuration file.
1212

1313
## Using local configuration files
1414

15-
Specify Ansible-lint configuration in either `.ansible-lint`,
16-
`.config/ansible-lint.yml`, or `.config/ansible-lint.yaml` in your current
17-
working directory.
15+
Specify Ansible-lint configuration in either
16+
`.ansible-lint`, `.ansible-lint.yml`, `.ansible-lint.yaml`,
17+
`.config/ansible-lint.yml`, or `.config/ansible-lint.yaml`
18+
in your current working directory.
1819

1920
!!! note
2021

src/ansiblelint/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ def get_config_path(config_file: str | None = None) -> str | None:
107107
else:
108108
project_filenames = [
109109
".ansible-lint",
110+
".ansible-lint.yml",
111+
".ansible-lint.yaml",
110112
".config/ansible-lint.yml",
111113
".config/ansible-lint.yaml",
112114
]
@@ -445,7 +447,7 @@ def get_cli_parser() -> argparse.ArgumentParser:
445447
"-c",
446448
"--config-file",
447449
dest="config_file",
448-
help="Specify configuration file to use. By default it will look for '.ansible-lint', '.config/ansible-lint.yml', or '.config/ansible-lint.yaml'",
450+
help="Specify configuration file to use. By default it will look for '.ansible-lint', '.ansible-lint.yml', '.ansible-lint.yaml', '.config/ansible-lint.yml', or '.config/ansible-lint.yaml'",
449451
)
450452
parser.add_argument(
451453
"-i",

src/ansiblelint/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
{"text": "**/templates/**/*.*"}, # templates are likely not validable
4343
{"execution-environment": "**/execution-environment.yml"},
4444
{"ansible-lint-config": "**/.ansible-lint"},
45-
{"ansible-lint-config": "**/.config/ansible-lint.yml"},
45+
{"ansible-lint-config": "**/.ansible-lint.{yaml,yml}"},
46+
{"ansible-lint-config": "**/.config/ansible-lint.{yaml,yml}"},
4647
{"ansible-navigator-config": "**/ansible-navigator.{yaml,yml}"},
4748
{"inventory": "**/inventory/**.{yaml,yml}"},
4849
{"requirements": "**/meta/requirements.{yaml,yml}"}, # v1 only

src/ansiblelint/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ def main():
207207

208208
CONFIG_FILENAMES = [
209209
".ansible-lint",
210+
".ansible-lint.yml",
211+
".ansible-lint.yaml",
210212
".config/ansible-lint.yml",
211213
".config/ansible-lint.yaml",
212214
]

src/ansiblelint/schemas/ansible-lint-config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"description": "https://ansible.readthedocs.io/projects/lint/configuring/",
2121
"examples": [
2222
".ansible-lint",
23+
".ansible-lint.yml",
24+
".ansible-lint.yaml",
2325
".config/ansible-lint.yml",
2426
".config/ansible-lint.yaml"
2527
],

0 commit comments

Comments
 (0)