Skip to content

excludes are relative to current directory, not typos.toml location #593

@embe-pw

Description

@embe-pw

When $DIR/typos.toml contains

[files]
extend-exclude = ["a/*.txt"]

and we run typos in $DIR, the file a/test.txt is correctly excluded. But when typos is run in $DIR/a, the exclude is not respected:

$ cat typos.toml
[files]
extend-exclude = ["a/*.txt"]
$ typos
$ (cd a; typos)
error: `tpyo` should be `typo`
  --> ./test.txt:1:1
  |
1 | tpyo
  | ^^^^
  |

When typos.toml excludes *.txt both cases work, so the issue is not caused by ignoring the configuration in the parent directory:

$ cat typos.toml
[files]
extend-exclude = ["*.txt"]
$ typos
$ (cd a; typos)

It would make sense to interpret the excludes relative to the typos.toml location.

(tested with typos 1.12.8 binary from the GitHub release)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configC-bugCategory: bugS-waiting-on-designStatus: Waiting on user-facing design to be resolved before implementing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions