forbid todo markers

This commit is contained in:
Aleksey Kladov 2019-03-18 00:25:54 +03:00
parent 15189bc724
commit 2394a2ee35

View File

@ -1,4 +1,6 @@
use tools::{generate, gen_tests, run_rustfmt, Verify};
use walkdir::WalkDir;
use tools::{generate, gen_tests, run_rustfmt, Verify, project_root};
#[test]
fn generated_grammar_is_fresh() {
@ -20,3 +22,25 @@ fn check_code_formatting() {
panic!("{}. Please format the code by running `cargo format`", error);
}
}
#[test]
fn no_todo() {
WalkDir::new(project_root().join("crates")).into_iter().for_each(|e| {
let e = e.unwrap();
if e.path().extension().map(|it| it != "rs").unwrap_or(true) {
return;
}
if e.path().ends_with("tests/cli.rs") {
return;
}
let text = std::fs::read_to_string(e.path()).unwrap();
if text.contains("TODO") {
panic!(
"\nTODO markers should not be commited to the master branch,\n\
use FIXME instead\n\
{}\n",
e.path().display(),
)
}
})
}