Skip to content

Commit f0973ce

Browse files
author
l
committed
file count
1 parent be06daf commit f0973ce

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/bin/pr-metadata-validator.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ async fn main() {
7878
expected_files_pattern,
7979
} => &format!("{}`{}`", WRONG_FILES, expected_files_pattern),
8080
ValidationResult::NoFiles => NO_FILES,
81+
ValidationResult::TooManyFiles => TOO_MANY_FILES,
8182
};
8283

8384
let full_message = format!(
@@ -145,6 +146,10 @@ const NO_FILES: &str = r#"This PR is missing any submitted files.
145146
146147
Please check that you committed the right files and pushed to the repository"#;
147148

149+
const TOO_MANY_FILES: &str = r#"There are too many files comitted in this pull request.
150+
151+
Please check and make sure you have not accidentally comitted a cache, virtual environment, or npm package directory."#;
152+
148153
#[derive(strum_macros::Display)]
149154
enum ValidationResult {
150155
Ok,
@@ -154,6 +159,7 @@ enum ValidationResult {
154159
UnknownRegion,
155160
WrongFiles { expected_files_pattern: String },
156161
NoFiles,
162+
TooManyFiles,
157163
}
158164

159165
async fn validate_pr(
@@ -307,6 +313,10 @@ async fn check_pr_file_changes(
307313
return Ok(ValidationResult::NoFiles); // no files committed
308314
}
309315

316+
if pr_files.len() > 100 {
317+
return Ok(ValidationResult::TooManyFiles); // too many files probably a venv or npm cache
318+
}
319+
310320
// check each file and error if one is in unexpected place
311321
for pr_file in pr_files {
312322
if pr_file.filename == ".gitignore" {

0 commit comments

Comments
 (0)