(ctx: &mut ValidationContext, name: &str)
| 617 | } |
| 618 | |
| 619 | fn check_plugin_name(ctx: &mut ValidationContext, name: &str) { |
| 620 | if name.chars().count() > 32 { |
| 621 | ctx.push_field_error("name", "name can be max 32 characters long".to_string()); |
| 622 | } |
| 623 | |
| 624 | if name.chars().count() < 3 { |
| 625 | ctx.push_field_error("name", "name can be minimum 3 characters long".to_string()); |
| 626 | } |
| 627 | |
| 628 | lazy_static! { |
| 629 | static ref RE: Regex = Regex::new(r#"^[\w_-]*$"#).unwrap(); |
| 630 | } |
| 631 | if !RE.is_match(name) { |
| 632 | ctx.push_field_error( |
| 633 | "name", |
| 634 | "name can only contain 'a-z', '-' and '_'".to_string(), |
| 635 | ); |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | fn check_script_name(ctx: &mut ValidationContext, name: &str) { |
| 640 | if name.chars().count() > 32 { |
no test coverage detected