Add max_file_size_mb and high_only logic to scanning process:

- Implement `max_file_size_mb` to restrict files for scanning based on size.
- Refactor `high_only` handling to modify `min_severity` in `Config`.
- Update `ScannerConfig` to use `Option<u64>` for optional size limits.
- Remove redundant `high_only` parameter from `scan::handle` function.
- Improve batch processing in `walk` for efficient file scanning.
This commit is contained in:
elipeter 2025-06-23 16:51:39 +02:00
parent b3e0db449d
commit 80c0bc9845
6 changed files with 47 additions and 15 deletions

View file

@ -5,16 +5,19 @@ pub mod clean;
use crate::cli::Commands;
use std::path::Path;
use crate::patterns::Severity;
use crate::utils::config::Config;
pub fn handle_command(
command: Commands,
database_dir: &Path,
config: &Config
config: &mut Config
) -> Result<(), Box<dyn std::error::Error>> {
match command {
Commands::Scan { path, no_index, rebuild_index, format, high_only } => {
scan::handle(&path, no_index, rebuild_index, format, high_only, database_dir, config)
if high_only { config.scanner.min_severity = Severity::High };
scan::handle(&path, no_index, rebuild_index, format, database_dir, config)
}
Commands::Index { action } => {
index::handle(action, database_dir, config)

View file

@ -30,7 +30,6 @@ pub fn handle(
no_index: bool,
rebuild_index: bool,
format: String,
high_only: bool,
database_dir: &Path,
config: &Config,
) -> Result<(), Box<dyn std::error::Error>> {
@ -52,7 +51,7 @@ pub fn handle(
if format == "console" || format == "" && config.output.default_format == "console" {
for d in &diags {
if high_only && d.severity != Severity::High {
if d.severity != Severity::High {
continue;
}
let sev_str = match d.severity {