]> git.lizzy.rs Git - rust.git/blob - src/tools/tidy/src/main.rs
Auto merge of #79607 - DrMeepster:maybe_uninit_write_slice, r=m-ou-se
[rust.git] / src / tools / tidy / src / main.rs
1 //! Tidy checks source code in this repository.
2 //!
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`.
6
7 use tidy::*;
8
9 use std::env;
10 use std::path::PathBuf;
11 use std::process;
12
13 fn main() {
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();
18
19     let src_path = root_path.join("src");
20     let library_path = root_path.join("library");
21     let compiler_path = root_path.join("compiler");
22
23     let args: Vec<String> = env::args().skip(1).collect();
24
25     let mut bad = false;
26     let verbose = args.iter().any(|s| *s == "--verbose");
27
28     // Checks over tests.
29     debug_artifacts::check(&src_path, &mut bad);
30     ui_tests::check(&src_path, &mut bad);
31
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);
35
36     // Checks that only make sense for the std libs.
37     pal::check(&library_path, &mut bad);
38
39     // Checks that need to be done for both the compiler and std libraries.
40     unit_tests::check(&src_path, &mut bad);
41     unit_tests::check(&compiler_path, &mut bad);
42     unit_tests::check(&library_path, &mut bad);
43
44     bins::check(&src_path, &output_directory, &mut bad);
45     bins::check(&compiler_path, &output_directory, &mut bad);
46     bins::check(&library_path, &output_directory, &mut bad);
47
48     style::check(&src_path, &mut bad);
49     style::check(&compiler_path, &mut bad);
50     style::check(&library_path, &mut bad);
51
52     cargo::check(&src_path, &mut bad);
53     cargo::check(&compiler_path, &mut bad);
54     cargo::check(&library_path, &mut bad);
55
56     edition::check(&src_path, &mut bad);
57     edition::check(&compiler_path, &mut bad);
58     edition::check(&library_path, &mut bad);
59
60     let collected = features::check(&src_path, &compiler_path, &library_path, &mut bad, verbose);
61     unstable_book::check(&src_path, collected, &mut bad);
62
63     // Checks that are done on the cargo workspace.
64     deps::check(&root_path, &cargo, &mut bad);
65     extdeps::check(&root_path, &mut bad);
66
67     if bad {
68         eprintln!("some tidy checks failed");
69         process::exit(1);
70     }
71 }