Skip to content

Commit 13e311b

Browse files
anxkhncopybara-github
authored andcommitted
chore: add codespell pre-commit hook to catch typos
Merge #6406 Add a codespell hook to catch typos automatically. Fix existing typos flagged by codespell. PiperOrigin-RevId: 952416492
1 parent 540cfdf commit 13e311b

13 files changed

Lines changed: 34 additions & 14 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,11 @@ repos:
7272
exclude: (?i)SKILL\.md$
7373
additional_dependencies:
7474
- mdformat-gfm
75+
- repo: https://github.com/codespell-project/codespell
76+
rev: v2.4.2
77+
hooks:
78+
- id: codespell
79+
# Configuration (skip globs, ignored words) lives in the
80+
# [tool.codespell] table in pyproject.toml.
81+
additional_dependencies:
82+
- tomli

contributing/samples/integrations/data_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
CREDENTIALS_TYPE = None
3737

3838
if CREDENTIALS_TYPE == AuthCredentialTypes.OAUTH2:
39-
# Initiaze the tools to do interactive OAuth
39+
# Initialize the tools to do interactive OAuth
4040
# The environment variables OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET
4141
# must be set
4242
credentials_config = DataAgentCredentialsConfig(

contributing/samples/integrations/oauth_calendar_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
SCOPES = ["https://www.googleapis.com/auth/calendar"]
4343

4444
calendar_toolset = CalendarToolset(
45-
# you can also replace below customized `list_calendar_events` with build-in
45+
# you can also replace below customized `list_calendar_events` with built-in
4646
# google calendar tool by adding `calendar_events_list` in the filter list
4747
client_id=oauth_client_id,
4848
client_secret=oauth_client_secret,

contributing/samples/integrations/spanner_rag_agent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ There are a few options to perform similarity search:
296296
"from the Spanner database."
297297
),
298298
instruction="""
299-
You are a helpful assistant that answers user questions to find the most relavant information from a Spanner database.
299+
You are a helpful assistant that answers user questions to find the most relevant information from a Spanner database.
300300
1. Always use the `similarity_search` tool to find relevant information.
301301
2. If no relevant information is found, say you don't know.
302302
3. Present all the relevant information naturally and well formatted in your response.

contributing/samples/workflows/route/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def route_on_category(category: InputCategory):
5757

5858
def handle_other():
5959
yield Event(
60-
message="Sorry I can only anwer questions or comment on statements."
60+
message="Sorry I can only answer questions or comment on statements."
6161
)
6262

6363

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ optional-dependencies.db = [
112112
"sqlalchemy-spanner>=1.14",
113113
]
114114
optional-dependencies.dev = [
115+
"codespell[toml]==2.4.2",
115116
"flit>=3.10",
116117
# Lint tools used by scripts/run_precommit_checks.sh (which runs them directly,
117118
# without the pre-commit framework). Formatters that rewrite files are pinned
@@ -300,6 +301,17 @@ line_length = 200
300301
single_line_exclusions = []
301302
known_third_party = [ "a2a", "google.adk" ]
302303

304+
[tool.codespell]
305+
# Real words/identifiers that codespell misreads as typos:
306+
# hel/serie/strin -> substrings in test fixtures; te -> local variable;
307+
# rouge -> the ROUGE metric; unparseable -> valid spelling variant;
308+
# re-use/re-used -> intentional hyphenation; lamda -> Google LaMDA project.
309+
ignore-words-list = "hel,serie,strin,te,rouge,unparseable,re-use,re-used,lamda"
310+
# CHANGELOG.md is generated from commit messages; lockfiles, notebooks, JSON
311+
# fixtures, bundled JS/source maps, and the vendored CLI browser bundle are
312+
# generated or data files, not prose we own.
313+
skip = "*CHANGELOG.md,*.lock,*.ipynb,*.json,*.js,*.map,*/cli/browser/*"
314+
303315
[tool.mypy]
304316
mypy_path = [ "src" ]
305317
exclude = [ "contributing/samples/", "tests/" ]

src/google/adk/evaluation/rubric_based_tool_use_quality_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class RubricBasedToolUseV1Evaluator(RubricBasedEvaluator):
136136
"""An Evaluator for rubric based assessment of the agent's usage of Tools.
137137
138138
Example: Lets take an example of a Weather Agent that has access to two tools:
139-
1: GeoCoding Tool: Coverts a city name, address or zip code into geographic
139+
1: GeoCoding Tool: Converts a city name, address or zip code into geographic
140140
coordinates.
141141
2: GetWeather Tool: Gets weather for the next 10 days for the given geographic
142142
coordinates.

src/google/adk/runners.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ async def run_live(
16311631
* **Other Control Events:** Most control events are saved.
16321632
16331633
**Events Saved to the Session:**
1634-
* **Live Model Audio Events with File Data:** Both input and ouput audio
1634+
* **Live Model Audio Events with File Data:** Both input and output audio
16351635
data are aggregated into an audio file saved into artifacts. The
16361636
reference to the file is saved as event in the `file_data` to session
16371637
if RunConfig.save_live_model_audio_to_session is True.

src/google/adk/tools/application_integration_tool/clients/connections_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def get_connector_base_spec() -> Dict[str, Any]:
248248
"host": {
249249
"type": "string",
250250
"default": "",
251-
"description": "Host name incase of tls service directory",
251+
"description": "Host name in case of tls service directory",
252252
},
253253
"entity": {
254254
"type": "string",

src/google/adk/tools/bigquery/skills/bigquery-graph/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ commas `,`. When multiple comma-separated patterns are used:
168168
**equijoin** on that variable.
169169

170170
```sql
171-
-- Equijoin example where 'interm' connects the two paths
171+
-- Equijoin example where 'interim' connects the two paths
172172
GRAPH <project>.<dataset>.<graph>
173-
MATCH (src:Account)-[t1:Transfers]->(interm:Account),
174-
(interm)<-[:Owns]-(p:Person)
173+
MATCH (src:Account)-[t1:Transfers]->(interim:Account),
174+
(interim)<-[:Owns]-(p:Person)
175175
RETURN src.id AS account_id, p.name AS owner_name
176176
```
177177

@@ -393,7 +393,7 @@ standard GoogleSQL that you **MUST** adhere to.
393393
In BigQuery Graph, unlike standard GoogleSQL, you **MUST** specify the graph
394394
name within the subquery block. If the outer query uses `GRAPH
395395
<project>.<dataset>.<graph>`, the internal subquery must also explicitly
396-
re-declare it.
396+
redeclare it.
397397

398398
```sql
399399
MATCH (n1)

0 commit comments

Comments
 (0)