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

[ci] Introduce typos pre-commit hook #6564

Merged
merged 14 commits into from
Dec 1, 2024
Merged

Conversation

borchero
Copy link
Collaborator

@borchero borchero commented Jul 21, 2024

While scrolling through the codebase, I noticed a few typos so I thought it would make sense to rectify them.

To do so, I added a new pre-commit hook, namely typos. typos is a spellchecker that minimizes the number of false positives by maintaining a list of known typos rather than a dictionary of known words.

typos can further be configured in the .typos.toml file where false positives can be rectified, either by extending the list of "identifiers" or "words" that are actually not typos as maintained by the typos tool (loosely speaking, an "identifier" is anything that would be a valid variable name in e.g. Python while a "word" are the individual parts of camel-cased/snake-cased/... names). For instances where the notion of "identifiers" and "words" is insufficient (e.g. for URLs with apparent typos), a list of regexes of strings to ignore can be added.


Apart from the changes to .pre-commit-config.yaml and the creation of .typos.toml, the changes in this PR merely fix the typos uncovered by the typos pre-commit hook.


The only publicly-facing change is the renaming of lgb.interprete to lgb.interpret in the R API. I'm unsure whether this change would be desired.

@borchero borchero changed the title [style] Introduce typos pre-commit hook [ci] Introduce typos pre-commit hook Jul 21, 2024
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow nice! I went through all of these changes and agree with almost all of them. This caught a lot of issues, really nice!

I support adding this to the pre-commit config. Let's see how it goes.

The only publicly-facing change is the renaming of lgb.interprete() to lgb.interpret() in the R API. I'm unsure whether this change would be desired.

Yeah, please do revert these. I don't support breaking user code just to fix this typo. That function has been a part of the public API for several years.

R-package/cran-comments.md Outdated Show resolved Hide resolved
docker/README.md Outdated Show resolved Hide resolved
docker/README.md Show resolved Hide resolved
@borchero borchero requested a review from jameslamb July 22, 2024 12:29
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much, happy to try this! Please just see 2 more small comments... I think maybe you forgot to push a commit.

docker/README.md Outdated Show resolved Hide resolved
docker/README.md Show resolved Hide resolved
@StrikerRUS
Copy link
Collaborator

The only publicly-facing change is the renaming of lgb.interprete to lgb.interpret in the R API. I'm unsure whether this change would be desired.

I think we should mark lgb.interprete as deprecated and remove it in a next release.
Under the hood lgb.interprete should call lgb.interpret for now.

.typos.toml Show resolved Hide resolved
@StrikerRUS
Copy link
Collaborator

@jameslamb

Yeah, please do revert these. I don't support breaking user code just to fix this typo. That function has been a part of the public API for several years.

Sorry, haven't noticed your comment from the first glance!

WDYT about the following #6564 (comment)?

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviving this!

I'm happy to pick up the R changes in a later PR... can you please document that in an issue and assign it to me? It might be a while until I can prioritize it.

Left one more request... please revert the unrelated whitespace changes in this PR.

CMakeLists.txt Outdated Show resolved Hide resolved
Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving.

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to try this, thanks!

@jameslamb jameslamb merged commit 784f384 into microsoft:master Dec 1, 2024
48 checks passed
@borchero borchero deleted the typos branch December 1, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants