Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSpell: How to exit without error when no files are checked? #1514

Closed
5 tasks done
CreativeTechGuy opened this issue Aug 13, 2021 · 4 comments
Closed
5 tasks done

CSpell: How to exit without error when no files are checked? #1514

CreativeTechGuy opened this issue Aug 13, 2021 · 4 comments

Comments

@CreativeTechGuy
Copy link

CreativeTechGuy commented Aug 13, 2021

Info

Kind of Issue

  • runtime - command-line tools

Which Tool or library

  • cspell -- the command-line spelling tool

Which Version

Version: 5.6.6

OS:

  • Macos
  • Linux
  • Windows

Bug Description

Running cspell on a single file which is excluded via ignorePaths results in a non-zero exit code.

To Reproduce

  • Create a cspell.json file with ignorePaths: ["someFile.json"]
  • Create a file someFile.json
  • Run npx cspell someFile.json
  • Output is CSpell: Files checked: 0, Issues found: 0 in 0 files but the exit code is 1

Expected behavior

Command should be a no-op and have a successful exit code

Additional context

This is a huge issue when running cspell in lint-staged on changed files. If only one file was changed, and that file is ignored via ignorePaths the commit fails even though it should succeed since the file is ignored.

cspell.json

@Jason3S
Copy link
Collaborator

Jason3S commented Aug 14, 2021

@CreativeTechGuy,

This behavior is by design.

Please check out npx cspell lint --help. I think npx cspell --no-must-find-files someFile.json will do what you want.

@Jason3S Jason3S changed the title cspell errors when no files are checked CSpell: How to exit without error when no files are checked? Aug 14, 2021
@CreativeTechGuy
Copy link
Author

Can the documentation for cspell be added to the README in the repo? That's the place I'd look for what arguments are available and how to use it. The only two things I see that are currently somewhat mentioned are cspell and cspell check but they don't really explain when to use each, or what other options there might be, etc.

I'd like to see a section like this which lists all of the CLI arguments and details (can even be generated directly from --help).

@Jason3S
Copy link
Collaborator

Jason3S commented Aug 16, 2021

@CreativeTechGuy,

Thank you for the feed back. I adjusted the cspell README with #1530.

@Jason3S Jason3S closed this as completed Aug 16, 2021
@github-actions
Copy link
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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants