Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for config with the yml/yaml extension #4416

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
7 changes: 4 additions & 3 deletions docs/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ the one specified inside the configuration file.

## Using local configuration files

Specify Ansible-lint configuration in either `.ansible-lint`,
`.config/ansible-lint.yml`, or `.config/ansible-lint.yaml` in your current
working directory.
Specify Ansible-lint configuration in either
`.ansible-lint`, `.ansible-lint.yml`, `.ansible-lint.yaml`,
`.config/ansible-lint.yml`, or `.config/ansible-lint.yaml`
in your current working directory.

!!! note

Expand Down
4 changes: 3 additions & 1 deletion src/ansiblelint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def get_config_path(config_file: str | None = None) -> str | None:
else:
project_filenames = [
".ansible-lint",
".ansible-lint.yml",
".ansible-lint.yaml",
".config/ansible-lint.yml",
".config/ansible-lint.yaml",
]
Expand Down Expand Up @@ -445,7 +447,7 @@ def get_cli_parser() -> argparse.ArgumentParser:
"-c",
"--config-file",
dest="config_file",
help="Specify configuration file to use. By default it will look for '.ansible-lint', '.config/ansible-lint.yml', or '.config/ansible-lint.yaml'",
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'",
)
parser.add_argument(
"-i",
Expand Down
3 changes: 2 additions & 1 deletion src/ansiblelint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
{"text": "**/templates/**/*.*"}, # templates are likely not validable
{"execution-environment": "**/execution-environment.yml"},
{"ansible-lint-config": "**/.ansible-lint"},
{"ansible-lint-config": "**/.config/ansible-lint.yml"},
{"ansible-lint-config": "**/.ansible-lint.{yaml,yml}"},
{"ansible-lint-config": "**/.config/ansible-lint.{yaml,yml}"},
{"ansible-navigator-config": "**/ansible-navigator.{yaml,yml}"},
{"inventory": "**/inventory/**.{yaml,yml}"},
{"requirements": "**/meta/requirements.{yaml,yml}"}, # v1 only
Expand Down
2 changes: 2 additions & 0 deletions src/ansiblelint/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ def main():

CONFIG_FILENAMES = [
".ansible-lint",
".ansible-lint.yml",
".ansible-lint.yaml",
".config/ansible-lint.yml",
".config/ansible-lint.yaml",
]
Expand Down
2 changes: 2 additions & 0 deletions src/ansiblelint/schemas/ansible-lint-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"description": "https://ansible.readthedocs.io/projects/lint/configuring/",
"examples": [
".ansible-lint",
".ansible-lint.yml",
".ansible-lint.yaml",
".config/ansible-lint.yml",
".config/ansible-lint.yaml"
],
Expand Down
Loading