Rollup merge of #41935 - iKevinY:detect-empty-files, r=Mark-Simulacrum
Add tidy check to detect empty files Addresses #18439.
This commit is contained in:
commit
ac02b64bc5
1 changed files with 5 additions and 0 deletions
|
|
@ -107,6 +107,11 @@ pub fn check(path: &Path, bad: &mut bool) {
|
|||
|
||||
contents.truncate(0);
|
||||
t!(t!(File::open(file), file).read_to_string(&mut contents));
|
||||
|
||||
if contents.is_empty() {
|
||||
tidy_error!(bad, "{}: empty file", file.display());
|
||||
}
|
||||
|
||||
let skip_cr = contents.contains("ignore-tidy-cr");
|
||||
let skip_tab = contents.contains("ignore-tidy-tab");
|
||||
let skip_length = contents.contains("ignore-tidy-linelength");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue