error out if lint name contains dash

This commit is contained in:
y21 2023-05-23 21:11:56 +02:00
parent 435a8ad86c
commit a3438da42f

View File

@ -180,7 +180,14 @@ fn get_clap_config() -> ArgMatches {
.short('n')
.long("name")
.help("Name of the new lint in snake case, ex: fn_too_long")
.required(true),
.required(true)
.value_parser(|name: &str| {
if name.contains('-') {
Err("Lint name cannot contain `-`, use `_` instead.")
} else {
Ok(name.to_owned())
}
}),
Arg::new("category")
.short('c')
.long("category")