line_length: Allow mapping values with long unbreakable lines
This commit is contained in:
@@ -72,6 +72,7 @@ Use this rule to set a limit to lines length.
|
||||
http://localhost/very/very/very/very/very/very/very/very/long/url
|
||||
"""
|
||||
|
||||
import yaml
|
||||
|
||||
from yamllint.linter import LintProblem
|
||||
|
||||
@@ -96,6 +97,11 @@ def check(conf, line):
|
||||
if line.buffer.find(' ', start, line.end) == -1:
|
||||
return
|
||||
|
||||
line_yaml = yaml.safe_load(line.content)
|
||||
if (isinstance(line_yaml, dict) and
|
||||
' ' not in line_yaml.popitem()[1]):
|
||||
return
|
||||
|
||||
yield LintProblem(line.line_no, conf['max'] + 1,
|
||||
'line too long (%d > %d characters)' %
|
||||
(line.end - line.start, conf['max']))
|
||||
|
||||
Reference in New Issue
Block a user