-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Changes from 4 commits
dd388a9
2b88d8b
0f7ef36
a8cbadd
4dea712
a77bae3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::walk::{filter_dirs, walk}; | ||
use serde::Deserialize; | ||
use std::path::Path; | ||
use toml::Value; | ||
|
||
#[derive(Deserialize)] | ||
struct Config {} | ||
aadityadhruv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
pub fn check(path: &Path, bad: &mut bool) { | ||
walk(path, &mut |path| filter_dirs(path), &mut |entry, contents| { | ||
let file = entry.path(); | ||
let filename = file.file_name().unwrap(); | ||
if filename != "triagebot.toml" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe only check the top-level There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I'll fix it. I had searched the repo for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only the top-level one is actually used by triagebot afaik. Several subdirectories of |
||
return; | ||
} | ||
let conf = contents.parse::<Value>(); | ||
match conf { | ||
Ok(_) => {} | ||
Err(_err) => { | ||
tidy_error!(bad, "{} is an invalid toml file", file.display()) | ||
} | ||
} | ||
}); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.