-
Notifications
You must be signed in to change notification settings - Fork 38
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
Ignoring paths is not supported in source_files #213
Comments
hi @carusooo
Is this a public repository? if so then please provide a link
|
It is a public repo, here's the spellcheck.yaml file. I ended up adding the filter to the changed file detection workflow step, since I think this action is basically connecting to the PySpelling CLI and passing in the files there. Overall I think I need to revise my approach to spellcheck the built HTML files since |
Hi @carusooo Thanks for sharing I will see what I can learn from it, perhaps something can be used in the action. |
I'm not sure what is meant by not supporting I'm certain an interested party could possibly use write their own filter using a Markdown parser that allows more control than what we currently use that might allow such control, but I would generally argue HTML is much easier to filter with available libraries. Often I build my documentation from Markdown and then use the HTML filter. As for file exclusions, PySpelling probably could make this more clear. I think we reference wcmatch (the library that controls this) but expect the user to take a look. But you can exclude directories. It uses the So you could do something like what is shown below. You can provide multiple rules that will be evaluated simultaneously if you separate them with sources:
- '!docs/api/**|**/*.mdx' Assuming this action passes the source normally to Pyspelling, I imagine you could do something similar. |
Since Pyspelling allows a list of source patterns, I wonder if I should just update it so all patterns our evaluated simultaneously so that this would work. sources
- '**/*.mdx'
- '!docs/api/**' There's no limitation in the underlying library to prevent this, I think we just loop through the sources...just because. |
I realized looking at the OP again, I did not read things very well as the opening post did specify how exclusions can be used 😅 . I also see that PySpelling documentation does indeed mention how exclusions are done (I didn't realize I had documented that). Regardless, I'm probably going to allow the following moving forward as I think it will be more intuitive for the user. I'm not exactly sure how this action interfaces with Pyspelling in this regard, but this should work via the
|
I believe the core problem is that when you specify the use of Meaning that all ignored files get processed even if specified to be ignored by the configuration file. So there is a conflict between the use from the Action perspective and the configuration file, since the action uses: From the documentation:
REF: https://facelessuser.github.io/pyspelling/ So I need to find a way to get the pattern from the configuration applied after the list of |
So you want to be able to append new sources to sources already in the pyspelling config? Is there a reason this approach is desired? The way PySpelling was designed was just to setup rules and then call them. If you want to override something, then you can from the command line. It's possible I don't understand the use case, but from my perspective, if you were going to constantly append certain files to the rules, my question would be why not permanently include those patterns in the config? |
@facelessuser I completely understand PySpelling and it's approach, but in the context of the GitHub Action, I am interested in only capturing the changed files, meaning a more dynamic approach. Here But as pointed out by @carusooo this does not work as expected since the |
@facelessuser I have a large repository consisting of Markdown files, it takes significant time to process, to only checking the changes files makes sense. Example output:
The repository contains 559 Markdown files if I count correctly. |
Okay, in that case, you would need to pass in exclude patterns with Let me know if that helps, if not you can join exclude and include with |
@facelessuser I will see if I can come up with a solution |
It's possible I can just add |
I have a proof of concept locally where a new option is added to specify the git merge-base, and when it is defined, only the modified files are checked: ➜ pyspelling git:(feature/git) ✗ python3 -m pyspelling -n python -v -m master
Using aspell to spellcheck python
Running Task: python...
Compiling Dictionary...
Searching: Only checking files that changed in git...
> Processing: pyspelling/__init__.py
> Processing: pyspelling/__main__.py
> Processing: pyspelling/util/git.py
Spelling check passed :) This could allow an easy way of checking only tracked, modified files in git and get access to inclusion and exclusion handling directly in PySpelling. Of course I need to test this directly in Github to see how well it works and probably should test it with an external PR from another user as well to see how it works. This action is not obligated to use such functionality and is free to implement its own way as well, but I felt like exploring this as a possibility. |
Branch that explores git handling in PySpelling https://github.com/facelessuser/pyspelling/pull/193/files. Things are subject to change and the addition of such functionality is not guaranteed but only being explored at the present. |
Hi @facelessuser and @carusooo I have made an attempt at a fix. which is local to the action by applying some file and filter gymnastics in the @facelessuser I might end up reevaluating this approach, but I very much think this was an issue for the action and not PySpelling, so addressing it in this context seems the best approach. If you decide on following up on the exploration you made, I might follow that path. |
That's fine. If there is no desire for it in PySpelling, I'm fine leaving it as is. |
I'm having issues with configuring spellcheck to ignore file paths when passed in via the source_files argument
From the documentation here and in PySpelling, it looks like this should be all that's required.
This is how the action is invoked
I suspect this is working as intended, wanted to confirm. I think I'll need to filter out the changed files in the github action
The text was updated successfully, but these errors were encountered: