Skip to content

Conversation

@jqnatividad
Copy link
Collaborator

resolves #2985

JSON Schema validation remains at one file at a time.

warning: called `map(<f>).unwrap_or(false)` on an `Option` value
    --> src/cmd/validate.rs:1133:9
     |
1133 | /         last_input
1134 | |             .extension()
1135 | |             .and_then(std::ffi::OsStr::to_str)
1136 | |             .map(|ext| ext.to_lowercase() == "json")
1137 | |             .unwrap_or(false)
     | |_____________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
     = note: `-W clippy::map-unwrap-or` implied by `-W clippy::pedantic`
     = help: to override `-W clippy::pedantic` add `#[allow(clippy::map_unwrap_or)]`
help: use `is_some_and(<f>)` instead
     |
1136 -             .map(|ext| ext.to_lowercase() == "json")
1136 +             .is_some_and(|ext| ext.to_lowercase() == "json")
     |

warning: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
    --> src/cmd/validate.rs:1470:26
     |
1470 |           let input_path = args
     |  __________________________^
1471 | |             .arg_input
1472 | |             .first()
1473 | |             .map(|p| p.to_string_lossy().to_string())
1474 | |             .unwrap_or_else(|| "stdin.csv".to_string());
     | |_______________________________________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
help: try
     |
1470 ~         let input_path = args
1471 +             .arg_input
1472 ~             .first().map_or_else(|| "stdin.csv".to_string(), |p| p.to_string_lossy().to_string());
     |

warning: this `if` statement can be collapsed
    --> src/cmd/validate.rs:1586:17
     |
1586 | /                 if !args.flag_quiet {
1587 | |                     if input_count > 1 {
1588 | |                         woutinfo!("❌ {}: {}", input_path.display(), e);
1589 | |                     }
1590 | |                 }
     | |_________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
     = note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
     |
1586 ~                 if !args.flag_quiet
1587 ~                     && input_count > 1 {
1588 |                         woutinfo!("❌ {}: {}", input_path.display(), e);
1589 ~                     }
     |

warning: this `else { if .. }` block can be collapsed
    --> src/cmd/validate.rs:1614:12
     |
1614 |       } else {
     |  ____________^
1615 | |         if input_count > 1 {
1616 | |             fail_clierror!(
1617 | |                 "{} out of {} files failed validation",
...    |
1625 | |     }
     | |_____^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
     = note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
     |
1614 ~     } else if input_count > 1 {
1615 +         fail_clierror!(
1616 +             "{} out of {} files failed validation",
1617 +             total_files - valid_files,
1618 +             total_files
1619 +         )
1620 +     } else {
1621 +         // For single files, just return the error without the summary message
1622 +         Err(CliError::Other("Validation failed".to_string()))
1623 +     }
@jqnatividad jqnatividad requested a review from Copilot September 25, 2025 17:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Extended Input Support to the RFC 4180 validation mode in the validate command, allowing validation of multiple files, directories, and .infile-list files while maintaining backward compatibility for single file validation and preserving JSON Schema validation as single-file only.

  • Extended the validate command to accept multiple input files for RFC 4180 validation
  • Added comprehensive test coverage for multiple file validation scenarios including directories, infile-lists, and various output formats
  • Refactored the validation logic to separate RFC 4180 and JSON Schema validation paths

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/cmd/validate.rs Major refactoring to support multiple input files, separated RFC 4180 and JSON Schema validation logic, added new functions for multi-file validation
tests/test_validate.rs Added comprehensive test suite covering multiple file validation scenarios, directories, infile-lists, JSON output, quiet mode, and backward compatibility

@jqnatividad jqnatividad requested a review from Copilot September 25, 2025 17:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

@jqnatividad jqnatividad merged commit f7c8693 into master Sep 26, 2025
15 checks passed
@jqnatividad jqnatividad deleted the 2985-validate-extended-input-support branch September 26, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate: add Extended Input Support

2 participants