Conversation
BUYT-1
left a comment
There was a problem hiding this comment.
Looks good, though I'd prefer a more granular approach. Ideally, even more granular than file-by-file basis, whitelisting each false positive explicitly. I'm thinking extend-ignore-re with enough context that it will never reasonably appear in another text or that it will always be a typo (e.g. \"mispelling\" is a misspelling). We can always add stuff to whitelists.
pyproject.toml
Outdated
| abd = "abd" | ||
| ba = "ba" | ||
| countr = "countr" | ||
| helo = "helo" |
There was a problem hiding this comment.
Why are these ignored in all project files?
There was a problem hiding this comment.
Because there is only one config and the rules from the config should apply to all files in a good way.
There was a problem hiding this comment.
https://github.com/crate-ci/typos/blob/master/docs/reference.md:
Configuration is read from the following (in precedence order)
- Command line arguments
- File specified via
--config PATH- Search parents of specified file / directory for one of
typos.toml,_typos.toml,.typos.toml,Cargo.toml, orpyproject.toml.
- In
pyproject.toml, the below fields must be under the[tool.typos]section. If this section does not
exist, the config file will be skipped.- In
Cargo.toml, the below fields must be under either[workspace.metadata.typos]or[package.metadata.typos]
Does this action apply only the first one it detects from the list or all of them but in order?
There was a problem hiding this comment.
I tested and action applied only one config which was detected (if I understood the question correctly)
pyproject.toml
Outdated
| countr = "countr" | ||
| helo = "helo" | ||
| nd = "nd" | ||
| identificator = "identificator" |
There was a problem hiding this comment.
Why is this word excluded? "identificator" is not a real word, "identifier" and "identification" are.
| "test_input_data" | ||
| ] | ||
|
|
||
| [tool.typos.default.extend-words] |
There was a problem hiding this comment.
I think it would be better to only ignore words per-file/directory, not project-wide. Let's say, ignore "ND" for src/core/algorithms/nd/*, ignore "nd" for the Python ND example, and other ND-related places, and don't ignore it in others (extend-ignore-words-re seems to not ignore case, so that can be used).
There was a problem hiding this comment.
Okay, I'll do that. However, since typos can't apply specific rules to specific files and directories, I think it needs to use a matrix in CI with different scenarios.
There was a problem hiding this comment.
Would it be a good idea to create different files for specific scenarios (e.g. typos_nd.toml, typos_other.toml, etc)?
pyproject.toml
Outdated
| "README.md", | ||
| "/README_PYPI.md", |
There was a problem hiding this comment.
Why are typos ignored in README files?
pyproject.toml
Outdated
| extend-exclude = [ | ||
| "README.md", | ||
| "/README_PYPI.md", | ||
| "examples/notebooks", |
There was a problem hiding this comment.
This is a tough one. Would it be too hard to dump notebook cell text to files (.py and .md so the action understands) and check those instead?
pyproject.toml
Outdated
| "examples/datasets", | ||
| "test_input_data" |
There was a problem hiding this comment.
I think this should have a more granular whitelist instead.
| ba = "ba" | ||
| countr = "countr" | ||
| helo = "helo" | ||
| nd = "nd" |
There was a problem hiding this comment.
"nd" instead of "and" is a legitimate typo, though
eec2ce2 to
9a68735
Compare
9a68735 to
8af305c
Compare
|
If it's too much of a pain to do fully, maybe we can merge as is and deal with the stuff I've pointed out later. |
No, it shouldn't be difficult, I'm a little busy right now, sorry( |
0030e04 to
a04eb7a
Compare
6d240ba to
e81a70a
Compare
- using regex in pyproject.toml and add new suitable rules - update version typos and remove 'with' option
e81a70a to
8cd488f
Compare
As it turns out, typos does not yet support layered configurations for working with specific directories and files, although there issues about this. Therefore, I had to create one general configuration file for the entire project. In this regard, some rules in the pyproject.toml file may seem strange.
If it is better to add some files to the ignore list or get it from, I am open for suggestions.