Skip to content

Commit ea1c009

Browse files
fix: Clean up verbose output (#8053)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 693383d commit ea1c009

29 files changed

+779
-424
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -69,37 +69,6 @@ jobs:
6969
# Ensure the repository is clean after build & test
7070
- run: git --no-pager diff --exit-code
7171

72-
test-full-build:
73-
runs-on: ${{ matrix.os }}
74-
75-
strategy:
76-
matrix:
77-
node-version:
78-
- 22.x
79-
80-
os:
81-
- ubuntu-latest
82-
83-
steps:
84-
- uses: actions/checkout@v5
85-
86-
- name: Setup
87-
uses: ./.github/actions/setup
88-
with:
89-
node-version: ${{ matrix.node-version }}
90-
91-
- name: Swap tsconfig.json
92-
run: |
93-
cp tsconfig.full.json tsconfig.json
94-
95-
- name: Display Config
96-
run: |
97-
echo "$(cat tsconfig.json)"
98-
99-
- run: pnpm i
100-
- run: pnpm run build
101-
- run: pnpm test
102-
10372
# Ensure the perf tests run on the latest node version
10473
perf-test:
10574
runs-on: ${{ matrix.os }}

eslint.config.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ const checkSpelling = !!process.env.CSPELL_CHECK_SPELLING;
1616

1717
export default defineConfig(
1818
eslint.configs.recommended,
19-
// @ts-expect-error incorrect types uses outdated eslint types
2019
nodePlugin.configs['flat/recommended'],
2120
...tsEslint.configs.recommended,
22-
// unicorn.configs['flat/recommended'],
2321
{
2422
ignores: ['**/*.json'],
2523
plugins: {

packages/cspell-json-reporter/src/CSpellJSONReporterSettings.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ export type CSpellJSONReporterSettings = {
1616
outFile?: string;
1717
/**
1818
* Add more information about the files being checked and the configuration
19-
* @default false
2019
*/
2120
verbose?: boolean;
21+
/**
22+
* Level of verbosity (higher number = more verbose).
23+
*/
24+
verboseLevel?: number;
2225
/**
2326
* Add information useful for debugging cspell.json files
2427
* @default false

packages/cspell-lib/api/api.d.ts

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cspell-lib/src/lib/textValidation/docValidator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ export class DocumentValidator {
157157
searchForDocumentConfig(this._document, settings, settings),
158158
)
159159
: undefined;
160-
pLocalConfig && timePromise(this.perfTiming, '_loadConfig', pLocalConfig);
160+
if (pLocalConfig) {
161+
timePromise(this.perfTiming, '_loadConfig', pLocalConfig);
162+
}
161163
const localConfig = (await catchPromiseError(pLocalConfig, (e) => this.addPossibleError(e))) || {};
162164

163165
this.addPossibleError(localConfig?.__importRef?.error);

packages/cspell-types/src/CSpellReporter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ interface ReporterCommandLineOptions {
230230
* Display verbose information
231231
*/
232232
verbose?: boolean;
233+
/**
234+
* Level of verbosity (higher number = more verbose).
235+
*/
236+
verboseLevel?: number;
233237
/**
234238
* Show extensive output.
235239
*/

packages/cspell/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"@cspell/cspell-types": "workspace:*",
8989
"@cspell/dynamic-import": "workspace:*",
9090
"@cspell/url": "workspace:*",
91+
"ansi-regex": "^6.2.2",
9192
"chalk": "^5.6.2",
9293
"chalk-template": "^1.1.2",
9394
"commander": "^14.0.2",

packages/cspell/src/__snapshots__/app.test.ts.snap

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ error"
446446
447447
exports[`Validate cli > app 'current_file --show-perf-summary' Expect Error: undefined 3`] = `""`;
448448
449-
exports[`Validate cli > app 'current_file --verbose' Expect Error: undefined 1`] = `[]`;
449+
exports[`Validate cli > app 'current_file --verbose --verbose' Expect Error: undefined 1`] = `[]`;
450450
451-
exports[`Validate cli > app 'current_file --verbose' Expect Error: undefined 2`] = `
451+
exports[`Validate cli > app 'current_file --verbose --verbose' Expect Error: undefined 2`] = `
452452
"info
453453
info cspell;
454454
info Date: Sat, 03 Apr 2021 11:25:33 GMT
@@ -461,7 +461,7 @@ info wordsOnly: No
461461
info unique: No
462462
info
463463
info Config Files Found:
464-
info ./cspell.json
464+
info cspell.json
465465
info
466466
info Exclusion Globs:
467467
info Glob: *.snap from ./cspell.json
@@ -479,16 +479,32 @@ info Glob: cspell.json from ./cspell.json
479479
info Glob: .vscode/** from ./cspell.json
480480
info Glob: node_modules/** from command line
481481
info
482-
info Checking: ./src/app.test.ts, File type: auto, Language: default
483-
info Checked: ./src/app.test.ts, File type: typescript, Language: en ... Issues: 0 0.00ms
484-
info Config file Used: ./cspell.json
485-
info Dictionaries Used: aws, companies, cryptocurrencies, filetypes, public-licenses, softwareTerms, coding-compound-terms, computing-acronyms, software-term-suggestions, software-tools, web-services, workspace, [in-document-dict], en_us, en-common-misspellings, fullstack, node, npm, svelte, typescript
482+
info
483+
info File type: typescript, Language: en, Issues: 0 0.00ms
484+
info Config file Used: cspell.json
485+
info Dictionaries Used:
486+
info [in-document-dict], aws, coding-compound-terms, companies,
487+
info computing-acronyms, cryptocurrencies, en-common-misspellings, en_us,
488+
info filetypes, fullstack, node, npm, public-licenses,
489+
info software-term-suggestions, software-tools, softwareTerms, svelte,
490+
info typescript, web-services, workspace
486491
error 1/1 src/app.test.ts 0.00ms
487492
error
488493
error CSpell: Files checked: 1, Issues found: 0 in 0 files.
489494
error"
490495
`;
491496
497+
exports[`Validate cli > app 'current_file --verbose --verbose' Expect Error: undefined 3`] = `""`;
498+
499+
exports[`Validate cli > app 'current_file --verbose' Expect Error: undefined 1`] = `[]`;
500+
501+
exports[`Validate cli > app 'current_file --verbose' Expect Error: undefined 2`] = `
502+
"error 1/1 src/app.test.ts 0.00ms
503+
error
504+
error CSpell: Files checked: 1, Issues found: 0 in 0 files.
505+
error"
506+
`;
507+
492508
exports[`Validate cli > app 'current_file --verbose' Expect Error: undefined 3`] = `""`;
493509
494510
exports[`Validate cli > app 'current_file languageId' Expect Error: undefined 1`] = `[]`;
@@ -541,15 +557,19 @@ info wordsOnly: No
541557
info unique: No
542558
info
543559
info Config Files Found:
544-
info ./fixtures/issue-2998/cspell.json
560+
info fixtures/issue-2998/cspell.json
545561
info
546562
info Exclusion Globs:
547563
info Glob: node_modules/** from command line
548564
info
549-
info Checking: ./fixtures/issue-2998/fix-words.txt, File type: fix, Language: default
550-
info Checked: ./fixtures/issue-2998/fix-words.txt, File type: fix, Language: en ... Issues: 0 0.00ms
551-
info Config file Used: ./fixtures/issue-2998/cspell.json
552-
info Dictionaries Used: aws, companies, cryptocurrencies, filetypes, public-licenses, softwareTerms, coding-compound-terms, computing-acronyms, software-term-suggestions, software-tools, web-services, en_us, en-common-misspellings, fixture
565+
info
566+
info File type: fix, Language: en, Issues: 0 0.00ms
567+
info Config file Used: cspell.json
568+
info Dictionaries Used:
569+
info aws, coding-compound-terms, companies, computing-acronyms,
570+
info cryptocurrencies, en-common-misspellings, en_us, filetypes, fixture,
571+
info public-licenses, software-term-suggestions, software-tools,
572+
info softwareTerms, web-services
553573
error 1/1 fix-words.txt 0.00ms
554574
error
555575
error CSpell: Files checked: 1, Issues found: 0 in 0 files.
@@ -745,7 +765,8 @@ exports[`Validate cli > app 'no-args' Expect Error: 'outputHelp' 1`] = `
745765
" the files being checked. Useful for limiting",
746766
" config inheritance.",
747767
" -v, --verbose Display more information about the files being",
748-
" checked and the configuration.",
768+
" checked. Add more than one -v for increased",
769+
" verbosity.",
749770
" --locale <locale> Set language locales. i.e. "en,fr" for English",
750771
" and French, or "en-GB" for British English.",
751772
" --language-id <file-type> Force programming language for unknown",
@@ -4004,7 +4025,8 @@ exports[`Validate cli > app help [ 'lint', '--help' ] 1`] = `
40044025
" the files being checked. Useful for limiting",
40054026
" config inheritance.",
40064027
" -v, --verbose Display more information about the files being",
4007-
" checked and the configuration.",
4028+
" checked. Add more than one -v for increased",
4029+
" verbosity.",
40084030
" --locale <locale> Set language locales. i.e. "en,fr" for English",
40094031
" and French, or "en-GB" for British English.",
40104032
" --language-id <file-type> Force programming language for unknown",
@@ -4137,7 +4159,8 @@ exports[`Validate cli > app help [ 'lint', '--help', '--issue-template' ] 1`] =
41374159
" the files being checked. Useful for limiting",
41384160
" config inheritance.",
41394161
" -v, --verbose Display more information about the files being",
4140-
" checked and the configuration.",
4162+
" checked. Add more than one -v for increased",
4163+
" verbosity.",
41414164
" --locale <locale> Set language locales. i.e. "en,fr" for English",
41424165
" and French, or "en-GB" for British English.",
41434166
" --language-id <file-type> Force programming language for unknown",
@@ -4297,7 +4320,8 @@ exports[`Validate cli > app help [ 'lint', '--help', '--verbose' ] 1`] = `
42974320
" the files being checked. Useful for limiting",
42984321
" config inheritance.",
42994322
" -v, --verbose Display more information about the files being",
4300-
" checked and the configuration.",
4323+
" checked. Add more than one -v for increased",
4324+
" verbosity.",
43014325
" --locale <locale> Set language locales. i.e. "en,fr" for English",
43024326
" and French, or "en-GB" for British English.",
43034327
" --language-id <file-type> Force programming language for unknown",

packages/cspell/src/app.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ describe('Validate cli', () => {
217217
${'LICENSE'} | ${[pathRoot('LICENSE')]} | ${undefined} | ${true} | ${false} | ${false}
218218
${'samples/Dutch.txt'} | ${[pathSamples('Dutch.txt')]} | ${app.CheckFailed} | ${true} | ${true} | ${false}
219219
${'with forbidden words'} | ${[pathSamples('src/sample-with-forbidden-words.md')]} | ${app.CheckFailed} | ${true} | ${true} | ${false}
220-
${'current_file --verbose'} | ${['--verbose', __filename]} | ${undefined} | ${true} | ${false} | ${true}
220+
${'current_file --verbose'} | ${['--verbose', __filename]} | ${undefined} | ${true} | ${false} | ${false}
221+
${'current_file --verbose --verbose'} | ${['--verbose', '--verbose', __filename]} | ${undefined} | ${true} | ${false} | ${true}
221222
${'bad config'} | ${['-c', __filename + '.x', __filename]} | ${app.CheckFailed} | ${true} | ${false} | ${false}
222223
${'not found error by default'} | ${['*.not']} | ${app.CheckFailed} | ${true} | ${false} | ${false}
223224
${'must find with error'} | ${['*.not', '--must-find-files']} | ${app.CheckFailed} | ${true} | ${false} | ${false}
@@ -228,7 +229,7 @@ describe('Validate cli', () => {
228229
${'--fail-fast with option'} | ${['-r', failFastRoot, '--fail-fast', '*.txt']} | ${app.CheckFailed} | ${true} | ${true} | ${false}
229230
${'--fail-fast with config'} | ${['-r', failFastRoot, '-c', failFastConfig, '*.txt']} | ${app.CheckFailed} | ${true} | ${true} | ${false}
230231
${'--no-fail-fast with config'} | ${['-r', failFastRoot, '--no-fail-fast', '-c', failFastConfig, '*.txt']} | ${app.CheckFailed} | ${true} | ${true} | ${false}
231-
${'issue-2998 --language-id'} | ${[rpFix('issue-2998'), '-v', '--language-id=fix', 'fix-words.txt']} | ${undefined} | ${true} | ${false} | ${true}
232+
${'issue-2998 --language-id'} | ${[rpFix('issue-2998'), '-v', '-v', '--language-id=fix', 'fix-words.txt']} | ${undefined} | ${true} | ${false} | ${true}
232233
${'Explicit file://'} | ${[rpFix('misc'), 'file://star-not.md']} | ${undefined} | ${true} | ${false} | ${false}
233234
${'Explicit not found file://'} | ${[rpFix('misc'), 'file://not-fond.md']} | ${app.CheckFailed} | ${true} | ${false} | ${false}
234235
${'typos'} | ${[rpFix('features/typos'), '--no-progress', '.']} | ${app.CheckFailed} | ${true} | ${true} | ${false}

packages/cspell/src/application.test.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('Validate the Application', () => {
4444
const lint = App.lint(files, options, reporter);
4545
const result = await lint;
4646
expect(reporter.errorCount).toBe(0);
47-
expect(reporter.infoCount).toBeGreaterThan(0);
47+
expect(reporter.infoCount).toBe(0); // verbose is off, no info messages.
4848
expect(reporter.debugCount).toBe(0);
4949
expect(reporter.runResult).toEqual(result);
5050
expect(result.files).toBe(1);
@@ -58,7 +58,7 @@ describe('Validate the Application', () => {
5858
const lint = App.lint(files, options, reporter);
5959
const result = await lint;
6060
expect(reporter.errorCount).toBe(0);
61-
expect(reporter.infoCount).toBeGreaterThan(0);
61+
expect(reporter.infoCount).toBe(0); // verbose is off, no info messages.
6262
expect(reporter.debugCount).toBe(0);
6363
expect(reporter.runResult).toEqual(result);
6464
expect(result.files).toBe(1);
@@ -72,7 +72,7 @@ describe('Validate the Application', () => {
7272
const lint = App.lint(files, options, reporter);
7373
const result = await lint;
7474
expect(reporter.errorCount).toBe(0);
75-
expect(reporter.infoCount).toBeGreaterThan(0);
75+
expect(reporter.infoCount).toBe(0); // verbose is off, no info messages.
7676
expect(reporter.debugCount).toBe(0);
7777
expect(reporter.runResult).toEqual(result);
7878
expect(result.files).toBe(1);
@@ -94,7 +94,7 @@ describe('Validate the Application', () => {
9494
const result = await App.lint(files, options, reporter);
9595

9696
expect(reporter.errorCount).toBe(0);
97-
expect(reporter.infoCount).toBeGreaterThan(0);
97+
expect(reporter.infoCount).toBe(0); // verbose is off, no info messages.
9898
expect(reporter.debugCount).toBe(0);
9999
expect(reporter.runResult).toEqual(result);
100100
expect(result.files).toBe(1);
@@ -111,6 +111,8 @@ describe('Validate the Application', () => {
111111
const options = {
112112
root: rootDir,
113113
stopConfigSearchAt: [stopSearchAt],
114+
verbose: true,
115+
verboseLevel: 2,
114116
};
115117

116118
const reporter = new InMemoryReporter();
@@ -139,6 +141,8 @@ describe('Validate the Application', () => {
139141
const options = {
140142
root: rootDir,
141143
stopConfigSearchAt,
144+
verbose: true,
145+
verboseLevel: 2,
142146
};
143147

144148
const reporter = new InMemoryReporter();
@@ -168,7 +172,7 @@ describe('Validate the Application', () => {
168172
const result = await lint;
169173

170174
expect(reporter.errorCount).toBe(0);
171-
expect(reporter.infoCount).toBeGreaterThan(0);
175+
expect(reporter.infoCount).toBe(0); // verbose is off, no info messages.
172176
expect(reporter.debugCount).toBe(0);
173177
expect(reporter.runResult).toEqual(result);
174178
expect(result.files).toBe(3);
@@ -217,7 +221,14 @@ describe('Validate the Application', () => {
217221

218222
test('running the application from stdin', testOptions, async () => {
219223
const files = ['stdin'];
220-
const options = { ...sampleOptions, wordsOnly: true, unique: true, debug: true };
224+
const options = {
225+
...sampleOptions,
226+
wordsOnly: true,
227+
unique: true,
228+
debug: true,
229+
verbose: true,
230+
verboseLevel: 2,
231+
};
221232
const reporter = new InMemoryReporter();
222233

223234
// cspell:ignore texxt

0 commit comments

Comments
 (0)