about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-26 14:11:21 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-27 17:58:54 +0100
commit243fb6f7b2cf595ab5b89ca0a73034b591c8e3a5 (patch)
treec659ed0014665cfde81889a53354d3fa9a422186 /src/tools
parent4eee955502558a049df75b4313a60cf57c885aa6 (diff)
Put back tidy check on error codes
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tidy/src/error_codes_check.rs1
-rw-r--r--src/tools/tidy/src/style.rs15
2 files changed, 13 insertions, 3 deletions
diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs
index 5364005840a..41c4b618e60 100644
--- a/src/tools/tidy/src/error_codes_check.rs
+++ b/src/tools/tidy/src/error_codes_check.rs
@@ -4,7 +4,6 @@
 use std::collections::HashMap;
 use std::ffi::OsStr;
 use std::fs::read_to_string;
-use std::io::Read;
 use std::path::Path;
 
 // A few of those error codes can't be tested but all the others can and *should* be tested!
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index 5abe481368d..20636c86e1e 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -141,17 +141,28 @@ pub fn check(path: &Path, bad: &mut bool) {
     super::walk(path, &mut super::filter_dirs, &mut |entry, contents| {
         let file = entry.path();
         let filename = file.file_name().unwrap().to_string_lossy();
-        let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h"];
+        let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md"];
         if extensions.iter().all(|e| !filename.ends_with(e)) ||
            filename.starts_with(".#") {
             return
         }
 
+        if filename.ends_with(".md") &&
+           file.parent()
+               .unwrap()
+               .file_name()
+               .unwrap()
+               .to_string_lossy() != "error_codes" {
+            // We don't want to check all ".md" files (almost of of them aren't compliant
+            // currently), just the long error code explanation ones.
+            return;
+        }
+
         if contents.is_empty() {
             tidy_error!(bad, "{}: empty file", file.display());
         }
 
-        let max_columns = if filename == "error_codes.rs" {
+        let max_columns = if filename == "error_codes.rs" || filename.ends_with(".md") {
             ERROR_CODE_COLS
         } else {
             COLS