Skip to content

--must-find-files no longer fails when all named files are excluded #9326

Closed

Description

@Jason3S

Since v10.2.0, --must-find-files no longer fails when every file passed with --file, --files, or --file-list is excluded.

Steps to reproduce

printf '{"ignorePaths":["sub/**"]}\n' > cspell.json
mkdir -p sub && printf 'hello\n' > sub/doc.md
npx cspell lint --file sub/doc.md
echo $?

Expected

Exit code 1, as before v10.2.0. --must-find-files is on by default, and an excluded file was not checked. This was the intended behavior: #2594 and #4747 were answered with --no-must-find-files.

Actual

Exit code 0, with Files checked: 0, skipped: 1.

The same happens when the only file is binary, for example --file image.png.

Cause

#9080 (--force-check) started counting excluded explicit files as found, so the "no files found" check no longer fires. It shows in the lint test data: files: ['../../resources/patreon.png' /* skip binary */] went from files: 0 to files: 1, skippedFiles: 1. The PR description doesn't mention this change.

Decide whether an excluded file counts as found for --must-find-files, and either restore the old behavior or document the new one.

Suggestion

When --must-find-files fails, say why. Today the run ends with exit code 1 and only the summary, for example CSpell: Files checked: 0, Issues found: 0 in 0 files., with no message about the failure. Add a short line such as No files found to check (2 skipped)., so it's clear the files were found but excluded. The reason each file was excluded can stay behind --verbose.

Activity

  1. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  2. locked as resolved and limited conversation to collaborators on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions