line_length: tweak tests

pull/370/head
Patryk Małek 4 years ago
parent 328ad7fc61
commit 63bab59422

@ -120,11 +120,22 @@ class LineLengthTestCase(RuleTestCase):
self.check('---\n'
'# http://www.verylongurlurlurlurlurlurlurlurl.com\n'
'key:\n'
' value:\n', conf)
' subkey: value\n', conf)
self.check('---\n'
'## http://www.verylongurlurlurlurlurlurlurlurl.com\n'
'key:\n'
' value:\n', conf)
' subkey: value\n', conf)
self.check('---\n'
'# # http://www.verylongurlurlurlurlurlurlurlurl.com\n'
'key:\n'
' subkey: value\n', conf,
problem=(2, 21))
self.check('---\n'
'#A http://www.verylongurlurlurlurlurlurlurlurl.com\n'
'key:\n'
' subkey: value\n', conf,
problem1=(2, 2, 'comments'),
problem2=(2, 21, 'line-length'))
conf = ('line-length: {max: 20, allow-non-breakable-words: true}\n'
'trailing-spaces: disable')

@ -140,11 +140,11 @@ def check(conf, line):
start += 1
if start != line.end:
if line.buffer[start] in ('#'):
idx = line.buffer.find(' ', start, line.end)
if idx != -1:
start = idx + 1
elif line.buffer[start] in ('-'):
if line.buffer[start] == '#':
while line.buffer[start] == '#':
start += 1
start += 1
elif line.buffer[start] == '-':
start += 2
if line.buffer.find(' ', start, line.end) == -1:

Loading…
Cancel
Save