1 //! Tidy checks source code in this repository.
3 //! This program runs all of the various tidy checks for style, cleanliness,
4 //! etc. This is run by default on `./x.py test` and as part of the auto
5 //! builders. The tidy checks can be executed with `./x.py test tidy`.
10 use std::path::PathBuf;
14 let root_path: PathBuf = env::args_os().nth(1).expect("need path to root of repo").into();
15 let cargo: PathBuf = env::args_os().nth(2).expect("need path to cargo").into();
16 let output_directory: PathBuf =
17 env::args_os().nth(3).expect("need path to output directory").into();
19 let src_path = root_path.join("src");
20 let library_path = root_path.join("library");
21 let compiler_path = root_path.join("compiler");
23 let args: Vec<String> = env::args().skip(1).collect();
26 let verbose = args.iter().any(|s| *s == "--verbose");
29 debug_artifacts::check(&src_path, &mut bad);
30 ui_tests::check(&src_path, &mut bad);
32 // Checks that only make sense for the compiler.
33 errors::check(&compiler_path, &mut bad);
34 error_codes_check::check(&src_path, &mut bad);
36 // Checks that only make sense for the std libs.
37 pal::check(&library_path, &mut bad);
38 unit_tests::check(&library_path, &mut bad);
40 // Checks that need to be done for both the compiler and std libraries.
41 bins::check(&src_path, &output_directory, &mut bad);
42 bins::check(&compiler_path, &output_directory, &mut bad);
43 bins::check(&library_path, &output_directory, &mut bad);
45 style::check(&src_path, &mut bad);
46 style::check(&compiler_path, &mut bad);
47 style::check(&library_path, &mut bad);
49 cargo::check(&src_path, &mut bad);
50 cargo::check(&compiler_path, &mut bad);
51 cargo::check(&library_path, &mut bad);
53 edition::check(&src_path, &mut bad);
54 edition::check(&compiler_path, &mut bad);
55 edition::check(&library_path, &mut bad);
57 let collected = features::check(&src_path, &compiler_path, &library_path, &mut bad, verbose);
58 unstable_book::check(&src_path, collected, &mut bad);
60 // Checks that are done on the cargo workspace.
61 deps::check(&root_path, &cargo, &mut bad);
62 extdeps::check(&root_path, &mut bad);
65 eprintln!("some tidy checks failed");