mirror of
https://github.com/adrienverge/yamllint.git
synced 2025-02-25 18:55:20 -06:00
Rules: comments: Allow empty comments
This commit is contained in:
parent
5cc900f2a8
commit
3989a09d32
@ -163,3 +163,15 @@ class CommentsTestCase(RuleTestCase):
|
||||
problem5=(9, 2),
|
||||
problem6=(10, 4),
|
||||
problem7=(13, 30))
|
||||
|
||||
def test_empty_comment(self):
|
||||
conf = ('comments:\n'
|
||||
' require-starting-space: yes\n'
|
||||
' min-spaces-from-content: 2\n')
|
||||
self.check('---\n'
|
||||
'# This is paragraph 1.\n'
|
||||
'#\n'
|
||||
'# This is paragraph 2.\n', conf)
|
||||
self.check('---\n'
|
||||
'inline: comment #\n'
|
||||
'\n', conf)
|
||||
|
@ -79,6 +79,7 @@ def check(conf, token, prev, next):
|
||||
|
||||
if (conf['require-starting-space'] and
|
||||
comment.pointer + 1 < len(comment.buffer) and
|
||||
comment.buffer[comment.pointer + 1] != ' '):
|
||||
comment.buffer[comment.pointer + 1] != ' ' and
|
||||
comment.buffer[comment.pointer + 1] != '\n'):
|
||||
yield LintProblem(comment.line, comment.column + 1,
|
||||
'missing starting space in comment')
|
||||
|
Loading…
Reference in New Issue
Block a user