Skip to main content

batch_lint

Function batch_lint 

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

Batch lint multiple HEDL files for best practices and style issues.

Lints multiple HEDL files for potential issues, style violations, and best practice deviations. Supports parallel processing for improved performance on large file sets.

§Arguments

  • patterns - List of file patterns (glob patterns or explicit paths)
  • warn_error - If true, treat warnings as errors (fail on any warning)
  • 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 no issues are found (or only hints), Err if errors or warnings (with warn_error enabled) are detected.

§Errors

Returns Err if:

  • Any file cannot be read
  • Any file contains syntax errors
  • Lint errors are found in any file
  • Warnings are found and warn_error is true

§Examples

use hedl_cli::commands::batch_lint;

// Lint multiple files
let patterns = vec!["*.hedl".to_string()];
batch_lint(patterns, false, false, 10, true, false)?;

// Strict linting (warnings as errors)
let patterns = vec!["**/*.hedl".to_string()];
batch_lint(patterns, true, true, 10, true, true)?;

§Output

Displays:

  • Progress information for each file
  • All lint diagnostics with severity, rule ID, message, and line number
  • Suggestions for fixing issues
  • Summary of total issues found

§Performance

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