Skip to main content

batch_validate

Function batch_validate 

Source
pub fn batch_validate(
    patterns: Vec<String>,
    strict: bool,
    recursive: bool,
    max_depth: usize,
    parallel: bool,
    verbose: bool,
) -> Result<(), CliError>
Expand description

Batch validate multiple HEDL files.

Validates multiple HEDL files for syntax and structural correctness, with optional parallel processing for improved performance on large file sets.

§Arguments

  • patterns - List of file patterns (glob patterns or explicit paths)
  • strict - If true, enables strict reference validation for all files
  • recursive - Enable recursive directory traversal
  • max_depth - Maximum recursion depth
  • parallel - If true, processes files in parallel (automatically enabled for 4+ files)
  • verbose - If true, shows detailed progress information

§Returns

Returns Ok(()) if all files are valid, Err with a summary if any fail.

§Errors

Returns Err if:

  • Any file cannot be read
  • Any file contains syntax errors
  • In strict mode, if any references cannot be resolved

§Examples

use hedl_cli::commands::batch_validate;

// Validate multiple files in parallel
let patterns = vec!["*.hedl".to_string()];
batch_validate(patterns, false, false, 10, true, false)?;

// Strict validation with verbose output
let patterns = vec!["**/*.hedl".to_string()];
batch_validate(patterns, true, true, 10, true, true)?;

§Output

Displays progress information and a summary:

  • Success/failure for each file (✓ or ✗)
  • Detailed error messages for failures
  • Final count of failures

§Performance

Automatically uses parallel processing when beneficial (4+ files by default). Can be forced with the parallel flag for smaller file sets.