chore: add codespell pre-commit hook to catch typos - #6406
Closed
anxkhn wants to merge 4 commits into
Closed
Conversation
The repo has no automated spell check, so misspellings only get caught by occasional reader-submitted typo PRs. Add a codespell hook to .pre-commit-config.yaml (already run in CI via pre-commit/action) with a [tool.codespell] table in pyproject.toml, tuned to skip generated/data files and ignore genuine false positives (the ROUGE metric, test-fixture substrings, a local variable, intentional hyphenation). Fix the existing typos codespell flags so the tree stays green. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Collaborator
|
Hi @anxkhn , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share. |
Collaborator
|
Hi @sasha-gitg , can you please review this. LGTM |
copybara-service Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
Merge #6406 Add a codespell hook to catch typos automatically. Fix existing typos flagged by codespell. PiperOrigin-RevId: 952416492
Collaborator
9 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
2. Or, if no issue exists, describe the change:
Problem:
There is no automated spell checker in the pre-commit config or CI. The
.pre-commit-config.yamlruns ruff, isort, pyink, addlicense, and mdformat, butnothing catches misspellings, so typos land in source, docstrings, samples, and
comments and are only fixed later by occasional one-off reader-submitted PRs.
Solution:
Add a codespell hook so typos
are caught automatically, both locally on commit and in CI.
.pre-commit-config.yaml: add thecodespellhook (rev: v2.4.2) withadditional_dependencies: [tomli]so it can read its config frompyproject.toml. The existinglintCI job already runspre-commit/actionwith no extra args, so the new hook becomes a CI gateautomatically. No separate workflow job is added, keeping the change minimal.
pyproject.toml: add a[tool.codespell]table with a small, tunedignore-words-list(genuine false positives only: the ROUGE metric, a coupleof test-fixture substrings, a local variable name, and intentional
hyphenation) and a
skiplist for generated/data files (CHANGELOG, lockfiles,notebooks, JSON fixtures, bundled JS/source maps, and the vendored CLI browser
bundle).
honestly (typos are fixed, not buried in the ignore list):
Initiaze->Initialize,build-in->built-in,relavant->relevant,anwer->answer(samples);Coverts->Converts,exsisting->existing,ouput->output,incase->in case,retreving->retrieving(source);
simplfy->simplify,successfull->successful(testcomments).
Testing Plan
Unit Tests:
This is a tooling and typo change (no runtime behavior changes), so no new unit
tests are added. The edits are limited to comments, docstrings, sample text, and
one JSON schema
descriptionstring; no test asserts on the changed strings.Verification run locally:
pre-commit run codespell --all-files-> Passed (exit 0).codespell(v2.4.2) bare walk, auto-readingpyproject.toml-> exit 0.pyteston the files with edited comments:tests/unittests/a2a/executor/test_a2a_agent_executor.py-> 25 passed.tests/unittests/integrations/bigquery/test_bigquery_query_tool.py->92 passed.
tests/unittests/tools/application_integration_tool/(covers the editedconnections_client.pyschema description) -> 78 passed.Manual End-to-End (E2E) Tests:
Not applicable: no user-facing runtime or UI behavior changes. The hook can be
exercised with
pre-commit run codespell --all-files.Checklist
Additional context
The ignore list is intentionally minimal so codespell keeps catching real typos
(verified it still flags things like
tehandrecieve); only genuine falsepositives are suppressed. Happy to drop the source/sample typo fixes into a
separate PR, or split the tool from the fixes, if the maintainers prefer.