From 2394a2ee35b40b1cb87369079860edf06d3b5a53 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 18 Mar 2019 00:25:54 +0300 Subject: forbid todo markers --- crates/tools/tests/cli.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs index aab52a4aa..6f82ae61d 100644 --- a/crates/tools/tests/cli.rs +++ b/crates/tools/tests/cli.rs @@ -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(), + ) + } + }) +} -- cgit v1.2.3