Skip to content

Conversation

@chaptersix
Copy link
Contributor

@chaptersix chaptersix commented Oct 16, 2025

What changed?

  • Add the typos cli tool to the linters in the Makfile and CI
  • Added a config file to exclude generated files and other common false positive scenarios

Why?

Reduce the amount of misspellings while not being overly burdensome.

How did you test it?

  • use an AI agent to propose file exclusion rules.
  • run locally and tested manually

Potential risks

Too much time and effort being used on adding exclusion.

Add crate-ci/typos spell checker to the project for automatic spell checking:
- Add _typos.toml configuration in .github/ (next to golangci config)
- Exclude generated protobuf files (*.pb.go, *.proto, etc.)
- Add typos job to GitHub Actions linters workflow
- Add lint-typos and lint-typos-changed targets to Makefile
- lint-typos-changed checks only files changed from main (fast for local dev)
- Integrate lint-typos-changed into main lint target for faster local runs
- Document inline ignore directives and --file-list usage in config

The spell checker will run in CI on all files, while local make lint
will only check changed files for better performance.
Added exceptions for intentional "misspellings" and false positives:
- Preemptable (used instead of Preemptible for caller types)
- ba, Ue, nd, abd (test data and hash strings)
- AVAILABILTY (backwards-compatible environment variable)
- Heartbeart/heartbeart (proto-generated field names - need proto fix first)
- SVG file exclusion (hex color codes trigger false positives)
- testdata directory exclusion
- json.gz file exclusion

These exceptions prevent the typo linter from flagging legitimate code
patterns and test data while still catching real spelling errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@@ -0,0 +1,63 @@
# Configuration for typos spell checker
Copy link
Contributor Author

Choose a reason for hiding this comment

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

generated by getting an agent to attempt spell corrections and propose exclusions.

@chaptersix
Copy link
Contributor Author

image

@chaptersix
Copy link
Contributor Author

> typos --config .github/_typos.toml --format json | wc -l                                                                                                                                                                                                                                                                                         
     573

@if command -v $(TYPOS) >/dev/null 2>&1; then \
$(TYPOS) --config .github/_typos.toml; \
else \
printf $(RED) "WARNING: typos is not installed. Install it from https://github.com/crate-ci/typos or run: cargo install typos-cli"; \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

opted to warn instead of installing. Open to changing this if there's a good pattern to follow for installation

Comment on lines +21 to +25
AVAILABILTY = "AVAILABILTY"
# Proto-generated field names that have typos in the proto definition
# These should be fixed in the proto file first, then regenerated
Heartbeart = "Heartbeart"
heartbeart = "heartbeart"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll double check these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant