(ctx: &mut ValidationContext, name: &str)
| 637 | } |
| 638 | |
| 639 | fn check_script_name(ctx: &mut ValidationContext, name: &str) { |
| 640 | if name.chars().count() > 32 { |
| 641 | ctx.push_field_error("name", "name can be max 32 characters long".to_string()); |
| 642 | } |
| 643 | |
| 644 | lazy_static! { |
| 645 | static ref RE: Regex = Regex::new(r#"^[\w_-]*$"#).unwrap(); |
| 646 | } |
| 647 | if !RE.is_match(name) { |
| 648 | ctx.push_field_error( |
| 649 | "name", |
| 650 | "name can only contain 'a-z', '-' and '_'".to_string(), |
| 651 | ); |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | pub fn check_script_source(ctx: &mut ValidationContext, field_name: &str, source: &str) { |
| 656 | if source.len() > 100_000 { |
no test coverage detected