diff --git a/docs/configuration.rst b/docs/configuration.rst index ac26c47..cadd29a 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -16,7 +16,7 @@ following locations (by order of preference): - ``.yamllint`` in the current working directory - ``$XDG_CONFIG_HOME/yamllint/config`` -- ``$HOME/.config/yamllint/config`` +- ``~/.config/yamllint/config`` Finally if no config file is found, the default configuration is applied. diff --git a/yamllint/cli.py b/yamllint/cli.py index 8e01701..525e162 100644 --- a/yamllint/cli.py +++ b/yamllint/cli.py @@ -87,13 +87,11 @@ def run(argv=None): sys.exit(-1) # User-global config is supposed to be in ~/.config/yamllint/config - user_global_config = None if 'XDG_CONFIG_HOME' in os.environ: user_global_config = os.path.join( os.environ['XDG_CONFIG_HOME'], 'yamllint', 'config') - elif 'HOME' in os.environ: - user_global_config = os.path.join( - os.environ['HOME'], '.config', 'yamllint', 'config') + else: + user_global_config = os.path.expanduser('~/.config/yamllint/config') try: if args.config_data is not None: @@ -104,7 +102,7 @@ def run(argv=None): conf = YamlLintConfig(file=args.config_file) elif os.path.isfile('.yamllint'): conf = YamlLintConfig(file='.yamllint') - elif user_global_config and os.path.isfile(user_global_config): + elif os.path.isfile(user_global_config): conf = YamlLintConfig(file=user_global_config) else: conf = YamlLintConfig('extends: default')