Tests: cli: Detect and handle the -d '' case

This commit is contained in:
Adrien Vergé
2016-03-25 13:25:28 +01:00
parent 53da21934d
commit 59d5bffbec
3 changed files with 17 additions and 2 deletions

View File

@@ -88,7 +88,7 @@ def run(argv=None):
try:
if args.config_data is not None:
if ':' not in args.config_data:
if args.config_data != '' and ':' not in args.config_data:
args.config_data = 'extends: ' + args.config_data
conf = YamlLintConfig(content=args.config_data)
elif args.config_file is not None:

View File

@@ -59,6 +59,9 @@ class YamlLintConfig(object):
except Exception as e:
raise YamlLintConfigError('invalid config: %s' % e)
if type(conf) != dict:
raise YamlLintConfigError('invalid config: not a dict')
self.rules = conf.get('rules', {})
# Does this conf override another conf that we need to load?