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

infra/linters: Replace spellcheck with Typos #153

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

Alex-deVis
Copy link

@Alex-deVis Alex-deVis commented Dec 14, 2024

Prerequisite Checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Updated relevant documentation (if needed).

Description of changes

Spellcheck is difficult to maintain because it complains about every unknown word, including technical terms, acronyms, and names.

Typos is a more relaxed spellchecker, which only complains about common misspellings and lets the user handle new words such as the previous examples. The configuration in .github/.typos.toml allows ignoring strings that match regexes, so we have a nice way of handling command outputs.

Additionally, our approach does not scale - the actions repo has 64 PRs that add new words. It is cumbersome to ask a contributor to add common technical terms for each contribution.

Copy link

@teodutu teodutu left a comment

Choose a reason for hiding this comment

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

Let's give it a shot. It can't be worse than spellcheck. Also add it to the actions repo [1] if it proves useful.

But can you run it locally?

[1] https://github.com/open-education-hub/actions

@github-actions github-actions bot added the area/infra Update to infrastructure / scripts label Dec 15, 2024
@Alex-deVis Alex-deVis changed the title infra/linters: Replace spellcheck with misspell infra/linters: Replace spellcheck with Typos Dec 15, 2024
@Alex-deVis
Copy link
Author

@teodutu I rebranded this to add Typos instead of misspell. I tested it locally and got some nice results - check the changed files. The downside is that there is no out-of-the-box docker image to run this locally but we can create our own.

@github-actions github-actions bot added area/assignment Update to homework assignments area/guides Update to guides content area/slides Update to slides content area/tasks Update to tasks topic/compute Related to "Compute" chapter topic/data Related to "Data" chapter kind/new New content / item labels Dec 15, 2024
Copy link

@teodutu teodutu left a comment

Choose a reason for hiding this comment

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

Add a lint rule to the Makefile that runs this linter locally.

@teodutu
Copy link

teodutu commented Dec 15, 2024

Ina addition, you'll have to add exceptions for what's causing typos to fail now and fix the other linter errors.

@Alex-deVis Alex-deVis self-assigned this Dec 15, 2024
@Alex-deVis Alex-deVis force-pushed the update-spellcheck branch 2 times, most recently from f5b94fe to c28f30a Compare December 28, 2024 19:20
@github-actions github-actions bot added the kind/improve Improve / Update existing content / item label Dec 29, 2024
@Alex-deVis Alex-deVis force-pushed the update-spellcheck branch 3 times, most recently from ad663e0 to be3e3d8 Compare December 29, 2024 11:17
@Alex-deVis Alex-deVis requested a review from teodutu December 29, 2024 11:17
CPPLINT.cfg Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
@teodutu
Copy link

teodutu commented Dec 29, 2024

Also, the super-linter errors do make sense. Fix them: https://github.com/cs-pub-ro/operating-systems/actions/runs/12534993042/job/34956380764?pr=153

@Alex-deVis
Copy link
Author

The checkpatch action will be fixed once open-education-hub/actions#100 is merged. The errors in superlinter are false positives.

@Alex-deVis Alex-deVis requested a review from teodutu December 30, 2024 09:08
Copy link

@teodutu teodutu left a comment

Choose a reason for hiding this comment

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

That one super-linter error is acutally bullshit. You can ignore it inline AFAIK, right?

@Alex-deVis
Copy link
Author

That one super-linter error is acutally bullshit. You can ignore it inline AFAIK, right?

No, you need to define a CPPLINT.cfg in that directory, which will overwrite the CPPLINT.cfg in the repo root.

The [build/include_what_you_use] error appears for a lot of our source files and always complains about not including string.h even though the sources compile. Since we are testing changes (mostly in production), missing imports will not be a problem, so I would rather remove this rule than having PRs falling over this.

For concrete examples, checkout #150 and remove the [build/include_what_you_use] line from the root CPPLINT.cfg.

What do you suggest, we ignore it globally or tackle it as we go?

@teodutu
Copy link

teodutu commented Dec 30, 2024

Ok now removing it in #150 makes sense. It seems this check spits false positive errors when encountering the string string :)))).

Use typos to find misspelled words since it does not require extensive
wordlists and it is easier to configurate. The trade-off is that it will
not complain about uncommon typos since it will assume they are
technical terms.
Overall it should be a lot easier to maintain than spellcheck.

Signed-off-by: Alex Apostolescu <[email protected]>
@Alex-deVis Alex-deVis merged commit 8aa1470 into cs-pub-ro:main Jan 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/assignment Update to homework assignments area/guides Update to guides content area/infra Update to infrastructure / scripts area/slides Update to slides content area/tasks Update to tasks kind/improve Improve / Update existing content / item kind/new New content / item topic/compute Related to "Compute" chapter topic/data Related to "Data" chapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants