]> git.lizzy.rs Git - rust.git/blob - src/tools/tidy/src/main.rs
Rollup merge of #50464 - est31:master, r=rkruppe
[rust.git] / src / tools / tidy / src / main.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Tidy checks source code in this repository
12 //!
13 //! This program runs all of the various tidy checks for style, cleanliness,
14 //! etc. This is run by default on `make check` and as part of the auto
15 //! builders.
16
17 #![deny(warnings)]
18
19 extern crate tidy;
20 use tidy::*;
21
22 use std::process;
23 use std::path::PathBuf;
24 use std::env;
25
26 fn main() {
27     let path = env::args_os().skip(1).next().expect("need path to src");
28     let path = PathBuf::from(path);
29
30     let cargo = env::args_os().skip(2).next().expect("need path to cargo");
31     let cargo = PathBuf::from(cargo);
32
33     let args: Vec<String> = env::args().skip(1).collect();
34
35     let mut bad = false;
36     let quiet = args.iter().any(|s| *s == "--quiet");
37     bins::check(&path, &mut bad);
38     style::check(&path, &mut bad);
39     errors::check(&path, &mut bad);
40     cargo::check(&path, &mut bad);
41     features::check(&path, &mut bad, quiet);
42     pal::check(&path, &mut bad);
43     unstable_book::check(&path, &mut bad);
44     libcoretest::check(&path, &mut bad);
45     if !args.iter().any(|s| *s == "--no-vendor") {
46         deps::check(&path, &mut bad);
47     }
48     deps::check_whitelist(&path, &cargo, &mut bad);
49     ui_tests::check(&path, &mut bad);
50
51     if bad {
52         eprintln!("some tidy checks failed");
53         process::exit(1);
54     }
55 }