Fixes
fix: Report unknown CSpell directives again (#9319)
fix: Report unknown CSpell directives again (#9319)
Summary
cspell lint reports unknown in-document directives again, such as cspell:bad-dir, when --validate-directives or validateDirectives: true in the config asks for them. Since 9.1.0 they were found but never shown or counted.
--validate-directivesand--no-validate-directivesoverride the config setting.- An unknown directive counts as an issue, so
cspell lintexits with an error, as it did before 9.1.0. - The JSON reporter,
@cspell/cspell-json-reporter, includes them in its output again.
Technical Details
- The default reporter and the JSON reporter now ask to receive directive issues. Other reporters still only get them if they ask for them.
- The command-line flag is now applied as a setting, like
--report, so it controls what is shown as well as what is checked.
fix(cspell-io): Keep redirected requests under the private root (#9329)
fix(cspell-io): Keep redirected requests under the private root (#9329)
Summary
createRedirectProvider in cspell-io now only serves requests that map to a location under its private root. A request that would resolve outside the private root is refused with VFSErrorUnsupportedRequest, the same error as a request outside the public root.
- Refused: a path that starts with a separator (
/,\,%2F,%5C) right after the public root. - Now served from inside the private root: file names that look like a URL scheme or a drive, such as
a:b.txtorC|. They used to resolve to a different URL.
cspell itself does not use createRedirectProvider. This affects projects that use cspell-io directly.
Technical Details
fix: Don't reuse cached results made with different command-line options (#9318)
fix: Don't reuse cached results made with different command-line options (#9318)
Summary
With --cache, cspell lint now rechecks a file when --language-id, --locale, --report, --show-suggestions, or --validate-directives differ from the run that cached its result. Before, the cached result was reused, so a run could report issues from the wrong language, at the wrong reporting level, or without suggestions.
Existing cache files keep working.
Technical Details
fix(cspell-lib): Don't scan the text of documents that won't be checked (#9311)
fix(cspell-lib): Don't scan the text of documents that won't be checked (#9311)
Summary
cspell-lib no longer searches the whole text of a document that won't be checked, such as one excluded by ignorePaths or with enabled: false. Tools built on cspell-lib that pass it such documents get their result faster, most noticeably for large files like lockfiles.
The cspell command line isn't affected: it already skips excluded files before this point.
Technical Details
ignorePaths, mostly lockfiles with 33 million characters in total, took about 1.2 seconds of this wasted work.
DocumentValidator._getPreparations() is deprecated. It was only meant for use inside cspell-lib, and will be removed in a future major version.
fix: `--show-perf-summary` shows where all of the run's time goes (#9307)
fix: --show-perf-summary shows where all of the run's time goes (#9307)
Summary
--show-perf-summary now accounts for all of Total Time. Before, about a sixth of it wasn't shown anywhere. Three new lines, together with Processing Time, add up to Total Time:
- Setup Time: before the first file is checked: loading configuration and finding files.
- Between Files: between one file and the next: deciding whether to check it, and reading it.
- Other Time: everything else.