mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	forbid todo markers
This commit is contained in:
		
							parent
							
								
									15189bc724
								
							
						
					
					
						commit
						2394a2ee35
					
				@ -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(),
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user