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

Regression 1.23.4 -> 1.23.5+. Cargo.toml file stopped being checked for typos #1124

Open
Veetaha opened this issue Oct 17, 2024 · 3 comments
Labels
question Uncertainty is involved

Comments

@Veetaha
Copy link

Veetaha commented Oct 17, 2024

Take this Cargo.toml file as an example (yes, it's not a valid cargo config, but just an example):

key = "compliation"
wher = 32

Make sure the file is named Cargo.toml exactly. If you run typos of version 1.23.5+ (including the latest one 1.26.0) against this file it won't produce any errors. Even if you run typos ./Cargo.toml by specifying the path to the file explicitly it still doesn't work.

Looks like the feature of storing the typos config in Cargo.toml broke its typos checking (release 1.23.5).

With the older version 1.23.4 everything works fine:

error: `compliation` should be `compilation`
  --> ./Cargo.toml:1:8
  |
1 | key = "compliation"
  |        ^^^^^^^^^^^
  |
error: `wher` should be `where`, `were`
  --> ./Cargo.toml:2:1
  |
2 | wher = 32
  | ^^^^
  |
@epage
Copy link
Collaborator

epage commented Oct 18, 2024

Hmm, this leads to competing needs.

Config files can define new invalid words. When we check a config file, it'll report those as invalid. So we skip checking of config files. As we add new config files (pyproject.toml, Cargo.toml), that means we won't be checking those file types anymore.

@epage epage added the question Uncertainty is involved label Oct 18, 2024
@Veetaha
Copy link
Author

Veetaha commented Oct 18, 2024

If Cargo.toml doesn't contain any typos config section it should definitely be checked for typos. This can be used as a low-effort heuristic that will just reduce the scope of the problem.

But if there is a typos config and it configures new invalid words then it's more complex and typos needs to track the span of the invalid word to avoid reporting it if the span is equal to the span of the word from the config. Won't there be a problem with hierarchical config here though? Maybe typos could be a bit less granular and avoid checking any text that overlaps with the span of any typos config?

@epage
Copy link
Collaborator

epage commented Oct 21, 2024

I don't think I want to go to the degree of span tracking.

I don't think I also want to do it based on whether the file has the section or not.

What might work is limiting the check to only the config we load.

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

No branches or pull requests

2 participants