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

Specify file line ranges #1017

Open
DanielCardonaRojas opened this issue May 21, 2024 · 3 comments
Open

Specify file line ranges #1017

DanielCardonaRojas opened this issue May 21, 2024 · 3 comments

Comments

@DanielCardonaRojas
Copy link

Hi,

I've been playing around with this awesome tool. One option I would love to see is a way to specify file ranges to spell check. Although could be considered controversial, some people might only want to spell check their git staged hunks, which helps avoid having larger PRs.

This gets pretty close:

git status -s | cut -c 4- | typos --file-list -

But will of course, spell-check the complete file, ideally I'd like to specify ranges for hunks so that when I apply suggestions I don't introduce new line changes.

@epage
Copy link
Collaborator

epage commented May 21, 2024

Know of any prior art for how users can specify hunks? Enumerating how other tools handle this today would help with the design and evaluation of this proposal.

@epage
Copy link
Collaborator

epage commented May 21, 2024

Also, what would the workflow look like for this? Having an idea of what it would take to adopt this feature can give an idea of how likely it is to be adopted which can affect the priority of it.

@DanielCardonaRojas
Copy link
Author

Thinking twice, I can only think of one practical form for this feature, I imagine that the output of git diff is parsed to extract line ranges and file names. I don't think it would be practical to pass a range per file manually, instead a patch file or the output of git diff is used, since it has all the information required to process specific parts of the files.

Something along the lines of:

git diff | typos --hunks -

I'll look around for other tools process hunks and will share my findings if any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants