Skip to content

Commit

Permalink
Add ability to load config from .config
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Feb 16, 2022
1 parent 205bfb4 commit ad03e96
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ansiblelint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ def load_config(config_file: str) -> Dict[Any, Any]:
return config


def get_config_path(config_file: str = ".ansible-lint") -> Optional[str]:
def get_config_path(config_file: Optional[str] = None) -> Optional[str]:
"""Return local config file."""
project_filenames = [config_file]
if config_file:
project_filenames = [config_file]
else:
project_filenames = [".ansible-lint", ".config/ansible-lint.yml"]
parent = tail = os.getcwd()
while tail:
for project_filename in project_filenames:
Expand Down Expand Up @@ -261,7 +264,7 @@ def get_cli_parser() -> argparse.ArgumentParser:
parser.add_argument(
"-c",
dest="config_file",
help="Specify configuration file to use. " 'Defaults to ".ansible-lint"',
help="Specify configuration file to use. By default it will look for '.ansible-lint' or '.config/ansible-lint.yml'",
)
parser.add_argument(
"--offline",
Expand Down

0 comments on commit ad03e96

Please sign in to comment.