diff --git a/Cargo.lock b/Cargo.lock index 4f48506b5af4f..cd6553214280e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5607,6 +5607,7 @@ dependencies = [ "regex", "semver", "termcolor", + "toml", "walkdir", ] @@ -5690,9 +5691,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.7" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index 5f5ae3a65efa8..5d5d4c1e6461f 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -13,6 +13,7 @@ walkdir = "2" ignore = "0.4.18" semver = "1.0.14" termcolor = "1.1.3" +toml = "0.5.10" [[bin]] name = "rust-tidy" diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 15c641d748c8e..a4957b7ebc160 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -64,6 +64,7 @@ pub mod pal; pub mod primitive_docs; pub mod style; pub mod target_specific_tests; +pub mod triagebot; pub mod ui_tests; pub mod unit_tests; pub mod unstable_book; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index a5685ba7c942c..6c535643ddaaf 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -109,6 +109,8 @@ fn main() { check!(x_version, &root_path, &cargo); + check!(triagebot, &root_path); + let collected = { drain_handles(&mut handles); diff --git a/src/tools/tidy/src/triagebot.rs b/src/tools/tidy/src/triagebot.rs new file mode 100644 index 0000000000000..2d9c7e22e5d68 --- /dev/null +++ b/src/tools/tidy/src/triagebot.rs @@ -0,0 +1,15 @@ +use std::path::Path; +use toml::Value; + +pub fn check(path: &Path, bad: &mut bool) { + let filename = path.join("triagebot.toml"); + let contents = std::fs::read_to_string(filename).unwrap(); + + let conf = contents.parse::(); + match conf { + Ok(_) => {} + Err(_err) => { + tidy_error!(bad, "triagebot.toml does not have valid TOML format") + } + } +}