Skip to content

Commit

Permalink
Apply new-lines check to all lines of a file, not just the first one
Browse files Browse the repository at this point in the history
  • Loading branch information
dbk-rabel authored Oct 17, 2024
1 parent 95e17b3 commit c544e22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yamllint/rules/new_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def check(conf, line):
elif conf['type'] == 'dos':
newline_char = '\r\n'

if line.start == 0 and len(line.buffer) > line.end:
if len(line.buffer) > line.end:
if line.buffer[line.end:line.end + len(newline_char)] != newline_char:
c = repr(newline_char).strip('\'')
yield LintProblem(1, line.end - line.start + 1,
yield LintProblem(line.line_no, line.end - line.start + 1,
f'wrong new line character: expected {c}')

0 comments on commit c544e22

Please sign in to comment.