Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2be2ea

Browse files
authored
Update migrate_config.py
Corrected loop condition to not run if configuration file only contains new lines.
1 parent 7b491c7 commit f2be2ea

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

pre_commit/commands/migrate_config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ def _migrate_map(contents):
2222
lines = contents.splitlines(True)
2323
i = 0
2424
# Only loop on non empty configuration file
25-
if i < len(lines):
26-
while _is_header_line(lines[i]):
27-
i += 1
25+
while i < len(lines) and _is_header_line(lines[i]):
26+
i += 1
2827

2928
header = ''.join(lines[:i])
3029
rest = ''.join(lines[i:])

0 commit comments

Comments
 (0)