Add the "quote-percent" option
This commit is contained in:
@@ -72,9 +72,11 @@ from yamllint.linter import LintProblem
|
||||
ID = 'quoted-strings'
|
||||
TYPE = 'token'
|
||||
CONF = {'quote-type': ('any', 'single', 'double'),
|
||||
'required': (True, False, 'only-when-needed')}
|
||||
'required': (True, False, 'only-when-needed'),
|
||||
'quote-percent': (True, False)}
|
||||
DEFAULT = {'quote-type': 'any',
|
||||
'required': True}
|
||||
'required': True,
|
||||
'quote-percent': False}
|
||||
|
||||
DEFAULT_SCALAR_TAG = u'tag:yaml.org,2002:str'
|
||||
START_TOKENS = {'#', '*', '!', '?', '@', '`', '&',
|
||||
@@ -129,6 +131,9 @@ def check(conf, token, prev, next, nextnext, context):
|
||||
|
||||
elif not token.plain:
|
||||
|
||||
if conf['quote-percent']:
|
||||
START_TOKENS.add('%')
|
||||
|
||||
# Quotes are disallowed when not needed
|
||||
if (tag == DEFAULT_SCALAR_TAG and token.value
|
||||
and token.value[0] not in START_TOKENS):
|
||||
|
||||
Reference in New Issue
Block a user