-
-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Labels
Description
Problem
Currently, cspell does not provide a built-in way to skip files based on their size. When working with repositories that contain large files (e.g., JSON/CSV data files), cspell will attempt to process them, which can lead to:
- Performance degradation and long processing times
- Memory issues when reading very large files
- Unnecessary spell-checking of files that don't benefit from it
Solution
Add a maxFileSize configuration option that automatically skips files exceeding a specified size threshold.
Configuration File Example
cspell.json:
{
"version": "0.2",
"maxFileSize": 1048576, // 1MB in bytes
"ignorePaths": ["node_modules/**"]
}cspell.config.js:
module.exports = {
maxFileSize: 1024 * 1024, // 1MB
// or with human-readable format
maxFileSize: '1MB',
};Command Line Flag Example
cspell lint --max-file-size 1048576 .
# or with human-readable format
cspell lint --max-file-size 1MB .Behavior
- Files exceeding
maxFileSizeshould be automatically skipped - Skipped files should be reported in verbose mode:
Skipped: large-file.json (size: 5MB, max: 1MB) - The default value should be unlimited (current behavior) for backward compatibility
- Size could be specified in bytes or with units (KB, MB, GB)
Alternatives
Users currently need to manually exclude large files using:
--excludepatterns (requires knowing specific file paths)ignorePathsin configuration (requires maintaining patterns).gitignoreintegration (not always suitable)
These workarounds are not ideal because they require manual maintenance and don't automatically handle files based on size.
Additional Context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable