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() {
|
|
|
|
|
let lint_list = collect_all();
|
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);
|
|
|
|
|
|
|
|
|
|
lints.sort_by(|a, b| a.name.cmp(&b.name));
|
|
|
|
|
|
|
|
|
|
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-07-17 22:50:17 +02:00
|
|
|
println!("there are {} lints", Lint::active_lints(&lint_list).len());
|
|
|
|
|
}
|