Add global "locale" config option and make key-ordering rule locale-aware
Support sorting by locale with strcoll(). Properly handle case and accents.
This commit is contained in:
@@ -35,6 +35,8 @@ class YamlLintConfig(object):
|
||||
self.yaml_files = pathspec.PathSpec.from_lines(
|
||||
'gitwildmatch', ['*.yaml', '*.yml', '.yamllint'])
|
||||
|
||||
self.locale = 'C.UTF-8'
|
||||
|
||||
if file is not None:
|
||||
with open(file) as f:
|
||||
content = f.read()
|
||||
@@ -111,6 +113,12 @@ class YamlLintConfig(object):
|
||||
self.yaml_files = pathspec.PathSpec.from_lines('gitwildmatch',
|
||||
conf['yaml-files'])
|
||||
|
||||
if 'locale' in conf:
|
||||
if not isinstance(conf['locale'], str):
|
||||
raise YamlLintConfigError(
|
||||
'invalid config: locale should be a string')
|
||||
self.locale = conf['locale']
|
||||
|
||||
def validate(self):
|
||||
for id in self.rules:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user