diff options
author | UK992 <urbankrajnc92@gmail.com> | 2016-08-29 18:33:03 +0200 |
---|---|---|
committer | UK992 <urbankrajnc92@gmail.com> | 2016-08-29 18:33:03 +0200 |
commit | d5b76c9f6d667ee660a8d5e2a2cec2935c9e65c2 (patch) | |
tree | 186134e5fa93ca1e2a1c49981861f917ec6df8e6 /python/tidy/servo_tidy/tidy.py | |
parent | 9e726b4d83fc169c38f176b9958cfb1b66363e8f (diff) | |
download | servo-d5b76c9f6d667ee660a8d5e2a2cec2935c9e65c2.tar.gz servo-d5b76c9f6d667ee660a8d5e2a2cec2935c9e65c2.zip |
Tidy: Handle empty files
Diffstat (limited to 'python/tidy/servo_tidy/tidy.py')
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index de3f83b84bd..340a3cd1a83 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -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)` |