rojopolis / spellcheck-github-actions

Spell check action
MIT License
138 stars 38 forks source link

Support ignoring files #176

Closed martincostello closed 1 year ago

martincostello commented 1 year ago

From looking at the documentation, it looks like you can specify files to check, but you can't specify files to exclude.

I have dozens of files I do want to check, but only a handful I want to ignore.

With DavidAnson/markdownlint-cli2-action for example, I can specify some globs:

- name: Lint Markdown files
  uses: DavidAnson/markdownlint-cli2-action@v13
  with:
    globs: |
      **/*.md
      !CHANGELOG.md
      !**/BenchmarkDotNet.Artifacts/**/*.md

It would be nice if similar functionality were supported so I don't need to list every file individually in the case I want to only ignore one or more files.

jonasbn commented 1 year ago

Hi @martincostello

The action is just a utility for PySpelling, so you could look into it's configuration, especially the part on sources.

I am doing some basic ignoring in one of my own repositories.

matrix:
- name: Markdown
  aspell:
    lang: en
  dictionary:
    wordlists:
    - .wordlist.txt
    encoding: utf-8
  pipeline:
  - pyspelling.filters.markdown:
      markdown_extensions:
      - pymdownx.superfences:
  - pyspelling.filters.html:
      comments: false
      ignores:
      - code
      - pre
  sources:
  - '!_site/*.md|!osx/list_available_voices_for_speechsynthesis.md|!clang/diagnostic_flags.md|*/*.md|README.md'
  default_encoding: utf-8

REF: https://github.com/jonasbn/til/blob/master/.spellcheck.yaml

I am no wizard on PySpelling and: wcmatch.glob which is the component used, perhaps it can help you out.

I will leave this issue open and will await you feedback.

martincostello commented 1 year ago

Thanks @jonasbn.

I did try a few ways of trying to ignore stuff, but they didn't seem to work. Putting all the globs on one line with pipes between seems to do the trick though, so that's my immediate requirement solved.

Maybe it's worth adding an example to your README illustrating how to do ignores?

jonasbn commented 1 year ago

Hi @martincostello

I will update the documentation with an example - thanks