2018-10-06 09:18:06 -07:00
|
|
|
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
|
2018-07-17 22:50:17 +02:00
|
|
|
extern crate clap;
|
|
|
|
extern crate clippy_dev;
|
|
|
|
extern crate regex;
|
|
|
|
|
|
|
|
use clap::{App, Arg, SubCommand};
|
|
|
|
use clippy_dev::*;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let matches = App::new("Clippy developer tooling")
|
|
|
|
.subcommand(
|
|
|
|
SubCommand::with_name("update_lints")
|
|
|
|
.about("Update the lint list")
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("print-only")
|
|
|
|
.long("print-only")
|
|
|
|
.short("p")
|
|
|
|
.help("Print a table of lints to STDOUT. Does not modify any files."),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.get_matches();
|
|
|
|
|
|
|
|
if let Some(matches) = matches.subcommand_matches("update_lints") {
|
|
|
|
if matches.is_present("print-only") {
|
|
|
|
print_lints();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn print_lints() {
|
2018-09-05 13:34:28 +02:00
|
|
|
let lint_list = gather_all().collect::<Vec<Lint>>();
|
2018-09-02 09:45:13 +02:00
|
|
|
let grouped_by_lint_group = Lint::by_lint_group(&lint_list);
|
|
|
|
|
|
|
|
for (lint_group, mut lints) in grouped_by_lint_group {
|
|
|
|
if lint_group == "Deprecated" { continue; }
|
|
|
|
println!("\n## {}", lint_group);
|
|
|
|
|
2018-10-15 21:02:38 +02:00
|
|
|
lints.sort_by_key(|l| l.name.clone());
|
2018-09-02 09:45:13 +02:00
|
|
|
|
|
|
|
for lint in lints {
|
2018-07-17 22:50:17 +02:00
|
|
|
println!("* [{}]({}#{}) ({})", lint.name, clippy_dev::DOCS_LINK.clone(), lint.name, lint.desc);
|
|
|
|
}
|
|
|
|
}
|
2018-09-02 09:45:13 +02:00
|
|
|
|
2018-10-11 08:34:51 +02:00
|
|
|
println!("there are {} lints", Lint::active_lints(lint_list.into_iter()).count());
|
2018-07-17 22:50:17 +02:00
|
|
|
}
|