diff --git a/src/bin/pr-metadata-validator.rs b/src/bin/pr-metadata-validator.rs index 03f8aa3..b6b42c7 100644 --- a/src/bin/pr-metadata-validator.rs +++ b/src/bin/pr-metadata-validator.rs @@ -78,6 +78,7 @@ async fn main() { expected_files_pattern, } => &format!("{}`{}`", WRONG_FILES, expected_files_pattern), ValidationResult::NoFiles => NO_FILES, + ValidationResult::TooManyFiles => TOO_MANY_FILES, }; let full_message = format!( @@ -145,6 +146,10 @@ const NO_FILES: &str = r#"This PR is missing any submitted files. Please check that you committed the right files and pushed to the repository"#; +const TOO_MANY_FILES: &str = r#"There are too many files comitted in this pull request. + +Please check and make sure you have not accidentally comitted a cache, virtual environment, or npm package directory."#; + #[derive(strum_macros::Display)] enum ValidationResult { Ok, @@ -154,6 +159,7 @@ enum ValidationResult { UnknownRegion, WrongFiles { expected_files_pattern: String }, NoFiles, + TooManyFiles, } async fn validate_pr( @@ -307,6 +313,10 @@ async fn check_pr_file_changes( return Ok(ValidationResult::NoFiles); // no files committed } + if pr_files.len() > 100 { + return Ok(ValidationResult::TooManyFiles); // too many files probably a venv or npm cache + } + // check each file and error if one is in unexpected place for pr_file in pr_files { if pr_file.filename == ".gitignore" {