mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Tidy: Handle empty files
This commit is contained in:
parent
9e726b4d83
commit
d5b76c9f6d
3 changed files with 8 additions and 0 deletions
|
@ -739,6 +739,9 @@ def collect_errors_for_files(files_to_check, checking_functions, line_checking_f
|
|||
continue
|
||||
with open(filename, "r") as f:
|
||||
contents = f.read()
|
||||
if not contents.strip():
|
||||
yield filename, 0, "file is empty"
|
||||
continue
|
||||
for check in checking_functions:
|
||||
for error in check(filename, contents):
|
||||
# the result will be: `(filename, line, message)`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue