streetsidesoftware / cspell

A Spell Checker for Code!
https://cspell.org
MIT License
1.24k stars 94 forks source link

Is there an option to exclude all unknown words from the output? #4613

Open isaak654 opened 1 year ago

isaak654 commented 1 year ago

Is your feature request related to a problem? Please describe.

  cspell: # run the cspell action
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Install node
        uses: actions/setup-node@v3
        with:
          node-version: '18'
          cache: 'npm'
          cache-dependency-path: '**/package-lock.json'
      - name: Install CSpell
        run: npm install -g cspell@latest
      - name: Check spelling
        run: npx cspell lint --config .github/cspell/cspell.json --unique "**/CHANGELOG.md"

The configuration produces a similar output:

/home/runner/work/repo/repofolder/CHANGELOG.md:28:24 - Forbidden word (word1)
/home/runner/work/repo/repofolder/CHANGELOG.md:28:24 - Forbidden word (word2)
/home/runner/work/repo/repofolder/CHANGELOG.md:279:11 - Unknown word (user1 without @)
/home/runner/work/repo/repofolder/CHANGELOG.md:284:3 - Unknown word (user2 without @)
/home/runner/work/repo/repofolder/CHANGELOG.md:863:36 - Unknown word (user3 without @)

Describe the solution you'd like I would like a way to exclude all unknown words in one shot from the output, so that only the forbidden words I have added in cspell.json are listed when encountered in CHANGELOG.md.

Describe alternatives you've considered I couldn't find anything so far... adding all unknown words in a custom exclusion list is not an option for my use case, because the changelog contains several credits and I think it would be embarrassing to exclude username references one by one.

Jason3S commented 1 year ago

@isaak654,

The spell checker does not have the feature to ignore all issues except forbidden.

It may seem annoying, but it is possible to ignore words within the document.

At the bottom of CHANGELOG.md, you could add:

<!---
cspell:ignore user1 user2 user3 user4
-->

<!--- ... --> is a markdown comment that will not render in the HTML.

isaak654 commented 1 year ago

I appreciate your suggestion, but it would be like maintaining a second list, which is considerably larger than the one shown in the example.

I hope my feature request will be taken into consideration.

Jason3S commented 1 month ago

Related #5820