-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Spell Checker #8495
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
Draft
chaptersix
wants to merge
6
commits into
main
Choose a base branch
from
alex/spell
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+111
−1
Draft
Spell Checker #8495
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d22aeee
Add typos spell checker to linters
chaptersix ea5ff83
Add typo dictionary exceptions to typos config
chaptersix db33930
only files in the diff
chaptersix d1b2104
fix
chaptersix 6e92d2f
add test mis-spell
chaptersix a2b98dd
undo
chaptersix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Configuration for typos spell checker | ||
| # See: https://github.com/crate-ci/typos | ||
|
|
||
| [default] | ||
| # Ensure we check binary file names | ||
| binary = false | ||
|
|
||
| [default.extend-words] | ||
| # Add custom dictionary entries here for intentional "misspellings" used in the codebase | ||
| # Preemptable is used consistently instead of "Preemptible" for caller types | ||
| Preemptable = "Preemptable" | ||
| preemptable = "preemptable" | ||
| # "ba" is a legitimate variable name in merge tests (shorthand for "b merged with a") | ||
| ba = "ba" | ||
| # Hash strings may contain letter combinations that look like typos | ||
| Ue = "Ue" | ||
| # Test data and base64 strings that contain letter combinations that look like typos | ||
| nd = "nd" | ||
| abd = "abd" | ||
| # Environment variable name that must remain for backwards compatibility | ||
| 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" | ||
|
Comment on lines
+21
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll double check these |
||
|
|
||
| [files] | ||
| # Exclude generated protobuf files | ||
| extend-exclude = [ | ||
| "*.pb.go", | ||
| "*.pb.gw.go", | ||
| "*.proto", | ||
| "*.binpb", | ||
| # Exclude other generated or third-party files | ||
| "*.gen.go", | ||
| "*.json.gz", | ||
| ".bin/**", | ||
| ".testoutput/**", | ||
| "vendor/**", | ||
| ".stamp/**", | ||
| "**/testdata/**", | ||
| # Exclude SVG files - they contain hex color codes that trigger false positives (e.g., #f38BA8) | ||
| "*.svg", | ||
| ] | ||
|
|
||
| [type.go] | ||
| extend-glob = ["*.go"] | ||
|
|
||
| # Inline typos ignore comments: | ||
| # To ignore a specific line, add a comment on the same line or the line before: | ||
| # // typos:disable-next-line | ||
| # var myVar = "mispeling" // intentional | ||
| # | ||
| # To ignore a specific word on a line: | ||
| # var myVar = "mispeling" // typos:ignore | ||
| # | ||
| # To disable checking for an entire file, add at the top: | ||
| # // typos:disable-file | ||
| # | ||
| # To check only changed files (useful for local development): | ||
| # git diff --name-only --diff-filter=ACMR main...HEAD | typos --file-list - | ||
| # Or check only staged files: | ||
| # git diff --cached --name-only | typos --file-list - | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,6 +133,16 @@ jobs: | |
| exit 1 | ||
| fi | ||
|
|
||
| typos: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: check spelling with typos | ||
| uses: crate-ci/[email protected] | ||
| with: | ||
| config: .github/_typos.toml | ||
chaptersix marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| linters-succeed: | ||
| name: All Linters Succeed | ||
| needs: | ||
|
|
@@ -141,6 +151,7 @@ jobs: | |
| - lint-actions | ||
| - fmt-imports | ||
| - golangci | ||
| - typos | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| env: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,6 +206,9 @@ ACTIONLINT := $(LOCALBIN)/actionlint-$(ACTIONLINT_VER) | |
| $(ACTIONLINT): | $(LOCALBIN) | ||
| $(call go-install-tool,$(ACTIONLINT),github.com/rhysd/actionlint/cmd/actionlint,$(ACTIONLINT_VER)) | ||
|
|
||
| TYPOS_VER := v1.28.4 | ||
chaptersix marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| TYPOS := typos | ||
|
|
||
| WORKFLOWCHECK_VER := master # TODO: pin this specific version once 0.3.0 follow-up is released | ||
| WORKFLOWCHECK := $(LOCALBIN)/workflowcheck-$(WORKFLOWCHECK_VER) | ||
| $(WORKFLOWCHECK): | $(LOCALBIN) | ||
|
|
@@ -379,7 +382,28 @@ fmt-imports: $(GCI) # Don't get confused, there is a single linter called gci, w | |
| @printf $(COLOR) "Formatting imports..." | ||
| @$(GCI) write --skip-generated -s standard -s default ./* | ||
|
|
||
| lint: lint-code lint-actions lint-api lint-protos | ||
| lint-typos: | ||
| @printf $(COLOR) "Checking spelling with typos..." | ||
| @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"; \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| echo ""; \ | ||
| echo "Skipping spell check..."; \ | ||
| fi | ||
|
|
||
| # Check spelling only on files changed from main branch | ||
| lint-typos-changed: | ||
| @printf $(COLOR) "Checking spelling on changed files with typos..." | ||
| @if command -v $(TYPOS) >/dev/null 2>&1; then \ | ||
| git diff --name-only --diff-filter=ACMR $(MAIN_BRANCH)...HEAD | $(TYPOS) --config .github/_typos.toml --file-list -; \ | ||
| else \ | ||
| printf $(RED) "WARNING: typos is not installed. Install it from https://github.com/crate-ci/typos or run: cargo install typos-cli"; \ | ||
| echo ""; \ | ||
| echo "Skipping spell check..."; \ | ||
| fi | ||
|
|
||
| lint: lint-code lint-actions lint-api lint-protos lint-typos-changed | ||
| @printf $(COLOR) "Run linters..." | ||
|
|
||
| lint-api: $(API_LINTER) $(API_BINPB) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.