Skip to content

Commit 2cfe569

Browse files
committed
config: Use "mapping" instead of "dict" for user-facing errors
Previously, these errors used the word "dict" because it's the common term in the Python world. But the YAML term is rather "mapping". The present commit fixes this wording. This originates from this discussion [^2]. [^1]: https://yaml.org/spec/1.2.2/#3211-nodes [^2]: #747 (review)
1 parent 79a6b2b commit 2cfe569

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

yamllint/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ def parse(self, raw_content):
7979
raise YamlLintConfigError(f'invalid config: {e}') from e
8080

8181
if not isinstance(conf, dict):
82-
raise YamlLintConfigError('invalid config: not a dict')
82+
raise YamlLintConfigError('invalid config: not a mapping')
8383

8484
self.rules = conf.get('rules', {})
8585
if not isinstance(self.rules, dict):
86-
raise YamlLintConfigError('invalid config: rules should be a dict')
86+
raise YamlLintConfigError('invalid config: rules should be a '
87+
'mapping')
8788
for rule in self.rules:
8889
if self.rules[rule] == 'enable':
8990
self.rules[rule] = {}
@@ -235,7 +236,7 @@ def validate_rule_conf(rule, conf):
235236
else:
236237
raise YamlLintConfigError(
237238
f'invalid config: rule "{rule.ID}": should be either "enable", '
238-
f'"disable" or a dict')
239+
f'"disable" or a mapping')
239240

240241
return conf
241242

0 commit comments

Comments
 (0)