Skip to content

Commit 243fb6f

Browse files
Put back tidy check on error codes
1 parent 4eee955 commit 243fb6f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/tools/tidy/src/error_codes_check.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use std::collections::HashMap;
55
use std::ffi::OsStr;
66
use std::fs::read_to_string;
7-
use std::io::Read;
87
use std::path::Path;
98

109
// A few of those error codes can't be tested but all the others can and *should* be tested!

src/tools/tidy/src/style.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,28 @@ pub fn check(path: &Path, bad: &mut bool) {
141141
super::walk(path, &mut super::filter_dirs, &mut |entry, contents| {
142142
let file = entry.path();
143143
let filename = file.file_name().unwrap().to_string_lossy();
144-
let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h"];
144+
let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md"];
145145
if extensions.iter().all(|e| !filename.ends_with(e)) ||
146146
filename.starts_with(".#") {
147147
return
148148
}
149149

150+
if filename.ends_with(".md") &&
151+
file.parent()
152+
.unwrap()
153+
.file_name()
154+
.unwrap()
155+
.to_string_lossy() != "error_codes" {
156+
// We don't want to check all ".md" files (almost of of them aren't compliant
157+
// currently), just the long error code explanation ones.
158+
return;
159+
}
160+
150161
if contents.is_empty() {
151162
tidy_error!(bad, "{}: empty file", file.display());
152163
}
153164

154-
let max_columns = if filename == "error_codes.rs" {
165+
let max_columns = if filename == "error_codes.rs" || filename.ends_with(".md") {
155166
ERROR_CODE_COLS
156167
} else {
157168
COLS

0 commit comments

Comments
 (0)