mirror of
https://github.com/odoo/documentation.git
synced 2025-12-12 07:29:27 +07:00
[FIX] tests: don't count EOL chars when checking remaining line space
This commit fixes a bug in the `check_early_line_breaks` test that would
systematically consider the `\n` character as being part of the line,
hence counting it when computing the line length.
closes odoo/documentation#12273
X-original-commit: e1a8a55c4f
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
@@ -139,12 +139,13 @@ def check_early_line_breaks(file, lines, options=None):
|
|||||||
for lno, line in enumerate(lines):
|
for lno, line in enumerate(lines):
|
||||||
if lno + 1 < len(lines):
|
if lno + 1 < len(lines):
|
||||||
next_line = lines[lno + 1]
|
next_line = lines[lno + 1]
|
||||||
if (is_valid_line(line, ('+', '|'))
|
if (
|
||||||
|
is_valid_line(line, ('+', '|'))
|
||||||
and is_valid_line(next_line, ('+', '|', '- ', '* ', '#. '))
|
and is_valid_line(next_line, ('+', '|', '- ', '* ', '#. '))
|
||||||
):
|
):
|
||||||
current_line_remaining_space = options.max_line_length - len(line)
|
current_line_remaining_space = options.max_line_length - len(line.rstrip())
|
||||||
next_line_first_word = get_next_line_first_word(next_line).rstrip()
|
next_line_first_word = get_next_line_first_word(next_line).rstrip()
|
||||||
if current_line_remaining_space > len(next_line_first_word):
|
if current_line_remaining_space >= len(next_line_first_word + ' '):
|
||||||
yield lno + 1, f"consider moving \"{next_line_first_word}\" to line {lno + 1}"
|
yield lno + 1, f"consider moving \"{next_line_first_word}\" to line {lno + 1}"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user