From 881d30188343287ad2684ce45dadad4e7738aa61 Mon Sep 17 00:00:00 2001 From: Ibrahim AshShohail Date: Sun, 25 Aug 2019 20:11:42 +0300 Subject: [PATCH] feat: Support reading config from .yamllint.yml and .yamllint.yaml Signed-off-by: Ibrahim AshShohail --- docs/configuration.rst | 3 ++- yamllint/cli.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 8ae3cc8..5e00169 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -14,7 +14,8 @@ To use a custom configuration file, use the ``-c`` option: If ``-c`` is not provided, yamllint will look for a configuration file in the following locations (by order of preference): -- ``.yamllint`` in the current working directory +- ``.yamllint``, ``.yamllint.yaml`` or ``.yamllint.yml`` in the current working + directory - ``$XDG_CONFIG_HOME/yamllint/config`` - ``~/.config/yamllint/config`` diff --git a/yamllint/cli.py b/yamllint/cli.py index d8f4927..0ffaae4 100644 --- a/yamllint/cli.py +++ b/yamllint/cli.py @@ -154,6 +154,10 @@ def run(argv=None): conf = YamlLintConfig(file=args.config_file) elif os.path.isfile('.yamllint'): conf = YamlLintConfig(file='.yamllint') + elif os.path.isfile('.yamllint.yaml'): + conf = YamlLintConfig(file='.yamllint.yaml') + elif os.path.isfile('.yamllint.yml'): + conf = YamlLintConfig(file='.yamllint.yml') elif os.path.isfile(user_global_config): conf = YamlLintConfig(file=user_global_config) else: