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

--extend-exclude doesn't work with absolute paths #1075

Open
ember91 opened this issue Aug 8, 2024 · 3 comments
Open

--extend-exclude doesn't work with absolute paths #1075

ember91 opened this issue Aug 8, 2024 · 3 comments
Labels
bug Not as expected

Comments

@ember91
Copy link

ember91 commented Aug 8, 2024

I hope this hasn't been reported before.

typos version: 1.23.6

/some/path/some_misspellings.txt is a file with errors which typos in its default configuration would detect.

/some/path/_typos.toml has the contents:

[files]
extend-exclude = [
    '/some_misspellings.txt'
]

This works as expected, i.e. no errors are reported:

cd /some/path/
typos --force-exclude some_misspellings.txt

Although this reports spelling errors:

cd /some/path/
typos --force-exclude /some/path/some_misspellings.txt

I assumed that they would lead to the same result.

@epage epage added the bug Not as expected label Aug 8, 2024
@epage
Copy link
Collaborator

epage commented Aug 8, 2024

extend-exclude makes paths relative to a "base directory", using gitignore syntax. So /some_misspellings.txt says that some_misspellings.txt should only be excluded if its in the root directory.

So the question is what is the root in this case. From a quick glance, it looks like its ".". It should probably be the parent directory of the config file. We are tracking this in #593.

Whatever the root is, we should make sure that a passed in path is checked against the root, regardless of format.

@ember91
Copy link
Author

ember91 commented Aug 8, 2024

Just to lessen any confusion: Removing the initial slash from extend-exclude leads to the same behavior as with a slash.

@epage
Copy link
Collaborator

epage commented Aug 8, 2024

Now, that is surprising.

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

No branches or pull requests

2 participants