Skip to content

Simple solution to validate toml in issue #106104 #106559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5607,6 +5607,7 @@ dependencies = [
"regex",
"semver",
"termcolor",
"toml",
"walkdir",
]

Expand Down Expand Up @@ -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",
]
Expand Down
1 change: 1 addition & 0 deletions src/tools/tidy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ fn main() {

check!(x_version, &root_path, &cargo);

check!(triagebot, &root_path);

let collected = {
drain_handles(&mut handles);

Expand Down
15 changes: 15 additions & 0 deletions src/tools/tidy/src/triagebot.rs
Original file line number Diff line number Diff line change
@@ -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::<Value>();
match conf {
Ok(_) => {}
Err(_err) => {
tidy_error!(bad, "triagebot.toml does not have valid TOML format")
}
}
}