Skip to content

Commit 45b1666

Browse files
Add codespell support (config, workflow to detect/not fix) and make it fix some typos (RooCodeInc#2939)
* Add github action to codespell main on push and PRs * Add rudimentary codespell config * run codespell throughout fixing typos automagically (but ignoring overall fail due to ambigous ones) === Do not change lines below === { "chain": [], "cmd": "codespell -w || :", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ * Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 4", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ * Fix Formatting --------- Co-authored-by: Dennis Bartlett <[email protected]>
1 parent 6c5b99d commit 45b1666

File tree

19 files changed

+63
-32
lines changed

19 files changed

+63
-32
lines changed

.codespellrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[codespell]
2+
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
3+
skip = .git*,*.svg,package-lock.json,*.css,.codespellrc,locales
4+
check-hidden = true
5+
ignore-regex = (\b(optIn|isTaller)\b|https://\S+)
6+
# ignore-words-list =

.github/workflows/codespell.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Codespell configuration is within .codespellrc
2+
---
3+
name: Codespell
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
codespell:
16+
name: Check for spelling errors
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Annotate locations with typos
23+
uses: codespell-project/codespell-problem-matcher@v1
24+
- name: Codespell
25+
uses: codespell-project/actions-codespell@v2

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
- Add recommended models for Cline provider
5959
- Add ability to detect when user edits files manually so Cline knows to re-read, leading to reduced diff edit errors
6060
- Add improvements to file mention searching for faster searching
61-
- Add scoring logic to file mentions to sort and exlcude results based on relevance
61+
- Add scoring logic to file mentions to sort and exclude results based on relevance
6262
- Add Support for Bytedance Doubao (Thanks Tunixer!)
6363
- Fix to prevent duplicate BOM (Thanks bamps53!)
6464

@@ -536,7 +536,7 @@
536536
- Adds "Always allow read-only operations" setting to let Claude read files and view directories without needing approval (off by default)
537537
- Implement sliding window context management to keep tasks going past 200k tokens
538538
- Adds Google Cloud Vertex AI support and updates Claude 3.5 Sonnet max output to 8192 tokens for all providers.
539-
- Improves system prompt to gaurd against lazy edits (less "//rest of code here")
539+
- Improves system prompt to guard against lazy edits (less "//rest of code here")
540540

541541
## [1.3.0]
542542

src/api/providers/openai-native.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class OpenAiNativeHandler implements ApiHandler {
5050
case "o1":
5151
case "o1-preview":
5252
case "o1-mini": {
53-
// o1 doesnt support streaming, non-1 temp, or system prompt
53+
// o1 doesn't support streaming, non-1 temp, or system prompt
5454
const response = await this.client.chat.completions.create({
5555
model: model.id,
5656
messages: [{ role: "user", content: systemPrompt }, ...convertToOpenAiMessages(messages)],

src/core/assistant-message/parse-assistant-message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function parseAssistantMessage(assistantMessage: string) {
123123
contentBlocks.push(currentToolUse)
124124
}
125125

126-
// Note: it doesnt matter if check for currentToolUse or currentTextContent, only one of them will be defined since only one can be partial at a time
126+
// Note: it doesn't matter if check for currentToolUse or currentTextContent, only one of them will be defined since only one can be partial at a time
127127
if (currentTextContent) {
128128
// stream did not complete text content, add it as partial
129129
contentBlocks.push(currentTextContent)

src/core/context/context-management/ContextManager.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ export class ContextManager {
537537

538538
// we can assume that thisExistingFileReads does not have many entries
539539
if (!thisExistingFileReads.includes(filePath)) {
540-
// meaning we havent already replaced this file read
540+
// meaning we haven't already replaced this file read
541541

542542
const entireMatch = match[0] // The entire matched string
543543

@@ -590,7 +590,7 @@ export class ContextManager {
590590
) {
591591
const pattern = new RegExp(`(<final_file_content path="[^"]*">)[\\s\\S]*?(</final_file_content>)`)
592592

593-
// check if this exists in the text, it wont exist if the user rejects the file change for example
593+
// check if this exists in the text, it won't exist if the user rejects the file change for example
594594
if (pattern.test(secondBlockText)) {
595595
const replacementText = secondBlockText.replace(pattern, `$1 ${formatResponse.duplicateFileReadNotice()} $2`)
596596
const indices = fileReadIndices.get(filePath) || []
@@ -741,7 +741,7 @@ export class ContextManager {
741741
let totalCharactersSaved = 0
742742

743743
for (let i = startIndex; i < endIndex; i++) {
744-
// looping over the outer indicies of messages
744+
// looping over the outer indices of messages
745745
const message = apiMessages[i]
746746

747747
if (!message.content) {
@@ -782,15 +782,15 @@ export class ContextManager {
782782

783783
totalCharCount += originalTextLength
784784
} else {
785-
// meaning there was an update to this text previously, but we didnt just alter it
785+
// meaning there was an update to this text previously, but we didn't just alter it
786786
totalCharCount += latestUpdate[2][0].length
787787
}
788788
} else {
789789
// reach here if there was one inner index with an update, but now we are at a different index, so updates is not defined
790790
totalCharCount += block.text.length
791791
}
792792
} else {
793-
// reach here if there's no alterations for this outer index, meaning each inner index wont have any changes either
793+
// reach here if there's no alterations for this outer index, meaning each inner index won't have any changes either
794794
totalCharCount += block.text.length
795795
}
796796
} else if (block.type === "image" && block.source) {

src/core/controller/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ export class Controller {
504504
break
505505
}
506506
case "checkpointRestore": {
507-
await this.cancelTask() // we cannot alter message history say if the task is active, as it could be in the middle of editing a file or running a command, which expect the ask to be responded to rather than being superceded by a new message eg add deleted_api_reqs
507+
await this.cancelTask() // we cannot alter message history say if the task is active, as it could be in the middle of editing a file or running a command, which expect the ask to be responded to rather than being superseded by a new message eg add deleted_api_reqs
508508
// cancel task waits for any open editor to be reverted and starts a new cline instance
509509
if (message.number) {
510510
// wait for messages to be loaded
@@ -1740,7 +1740,7 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
17401740
}
17411741
}
17421742
// if we tried to get a task that doesn't exist, remove it from state
1743-
// FIXME: this seems to happen sometimes when the json file doesnt save to disk for some reason
1743+
// FIXME: this seems to happen sometimes when the json file doesn't save to disk for some reason
17441744
await this.deleteTaskFromState(id)
17451745
throw new Error("Task not found")
17461746
}
@@ -1917,7 +1917,7 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
19171917
// conversation history to send in API requests
19181918
19191919
/*
1920-
It seems that some API messages do not comply with vscode state requirements. Either the Anthropic library is manipulating these values somehow in the backend in a way thats creating cyclic references, or the API returns a function or a Symbol as part of the message content.
1920+
It seems that some API messages do not comply with vscode state requirements. Either the Anthropic library is manipulating these values somehow in the backend in a way that's creating cyclic references, or the API returns a function or a Symbol as part of the message content.
19211921
VSCode docs about state: "The value must be JSON-stringifyable ... value — A value. MUST not contain cyclic references."
19221922
For now we'll store the conversation history in memory, and if we need to store in state directly we'd need to do a manual conversion to ensure proper json stringification.
19231923
*/

src/core/task/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ export class Task {
440440
return
441441
}
442442

443-
// TODO: handle if this is called from outside original workspace, in which case we need to show user error message we cant show diff outside of workspace?
443+
// TODO: handle if this is called from outside original workspace, in which case we need to show user error message we can't show diff outside of workspace?
444444
if (!this.checkpointTracker && !this.checkpointTrackerErrorMessage) {
445445
try {
446446
this.checkpointTracker = await CheckpointTracker.create(this.taskId, this.context.globalStorageUri.fsPath)
@@ -885,7 +885,7 @@ export class Task {
885885
await this.overwriteClineMessages(modifiedClineMessages)
886886
this.clineMessages = await getSavedClineMessages(this.getContext(), this.taskId)
887887

888-
// Now present the cline messages to the user and ask if they want to resume (NOTE: we ran into a bug before where the apiconversationhistory wouldnt be initialized when opening a old task, and it was because we were waiting for resume)
888+
// Now present the cline messages to the user and ask if they want to resume (NOTE: we ran into a bug before where the apiconversationhistory wouldn't be initialized when opening a old task, and it was because we were waiting for resume)
889889
// This is important in case the user deletes messages without resuming the task first
890890
this.apiConversationHistory = await getSavedApiConversationHistory(this.getContext(), this.taskId)
891891

@@ -2433,7 +2433,7 @@ export class Task {
24332433
try {
24342434
if (block.partial) {
24352435
if (this.shouldAutoApproveTool(block.name)) {
2436-
// since depending on an upcoming parameter, requiresApproval this may become an ask - we cant partially stream a say prematurely. So in this particular case we have to wait for the requiresApproval parameter to be completed before presenting it.
2436+
// since depending on an upcoming parameter, requiresApproval this may become an ask - we can't partially stream a say prematurely. So in this particular case we have to wait for the requiresApproval parameter to be completed before presenting it.
24372437
// await this.say(
24382438
// "command",
24392439
// removeClosingTag("command", command),
@@ -2479,7 +2479,7 @@ export class Task {
24792479

24802480
let didAutoApprove = false
24812481

2482-
// If the model says this command is safe and auto aproval for safe commands is true, execute the command
2482+
// If the model says this command is safe and auto approval for safe commands is true, execute the command
24832483
// If the model says the command is risky, but *BOTH* auto approve settings are true, execute the command
24842484
const autoApproveResult = this.shouldAutoApproveTool(block.name)
24852485
const [autoApproveSafe, autoApproveAll] = Array.isArray(autoApproveResult)
@@ -3003,7 +3003,7 @@ export class Task {
30033003
)
30043004
} else {
30053005
// last message is completion_result
3006-
// we have command string, which means we have the result as well, so finish it (doesnt have to exist yet)
3006+
// we have command string, which means we have the result as well, so finish it (doesn't have to exist yet)
30073007
await this.say("completion_result", removeClosingTag("result", result), undefined, false)
30083008
await this.saveCheckpoint(true)
30093009
await addNewChangesFlagToLastCompletionResultMessage()
@@ -3039,7 +3039,7 @@ export class Task {
30393039
let commandResult: ToolResponse | undefined
30403040
if (command) {
30413041
if (lastMessage && lastMessage.ask !== "command") {
3042-
// havent sent a command message yet so first send completion_result then command
3042+
// haven't sent a command message yet so first send completion_result then command
30433043
await this.say("completion_result", result, undefined, false)
30443044
await this.saveCheckpoint(true)
30453045
await addNewChangesFlagToLastCompletionResultMessage()
@@ -3408,7 +3408,7 @@ export class Task {
34083408
if (this.didRejectTool) {
34093409
// userContent has a tool rejection, so interrupt the assistant's response to present the user's feedback
34103410
assistantMessage += "\n\n[Response interrupted by user feedback]"
3411-
// this.userMessageContentReady = true // instead of setting this premptively, we allow the present iterator to finish and set userMessageContentReady when its ready
3411+
// this.userMessageContentReady = true // instead of setting this preemptively, we allow the present iterator to finish and set userMessageContentReady when its ready
34123412
break
34133413
}
34143414

@@ -3463,7 +3463,7 @@ export class Task {
34633463
partialBlocks.forEach((block) => {
34643464
block.partial = false
34653465
})
3466-
// this.assistantMessageContent.forEach((e) => (e.partial = false)) // cant just do this bc a tool could be in the middle of executing ()
3466+
// this.assistantMessageContent.forEach((e) => (e.partial = false)) // can't just do this bc a tool could be in the middle of executing ()
34673467
if (partialBlocks.length > 0) {
34683468
this.presentAssistantMessage() // if there is content to update then it will complete and update this.userMessageContentReady to true, which we pwaitfor before making the next request. all this is really doing is presenting the last partial message that we just set to complete
34693469
}

src/core/webview/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class WebviewProvider implements vscode.WebviewViewProvider {
193193
/*
194194
content security policy of your webview to only allow scripts that have a specific nonce
195195
create a content security policy meta tag so that only loading scripts with a nonce is allowed
196-
As your extension grows you will likely want to add custom styles, fonts, and/or images to your webview. If you do, you will need to update the content security policy meta tag to explicity allow for these resources. E.g.
196+
As your extension grows you will likely want to add custom styles, fonts, and/or images to your webview. If you do, you will need to update the content security policy meta tag to explicitly allow for these resources. E.g.
197197
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${webview.cspSource}; font-src ${webview.cspSource}; img-src ${webview.cspSource} https:; script-src 'nonce-${nonce}';">
198198
- 'unsafe-inline' is required for styles due to vscode-webview-toolkit's dynamic style injection
199199
- since we pass base64 images to the webview, we need to specify img-src ${webview.cspSource} data:;

src/integrations/diagnostics/DiagnosticsMonitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class DiagnosticsMonitor {
6161
return currentDiagnostics
6262
}
6363
64-
let timeout = 300 // only way this happens is if theres no errors
64+
let timeout = 300 // only way this happens is if there's no errors
6565
6666
// if diagnostics contain existing errors (since the check above didn't trigger) then it's likely cline just did something that should have fixed the error, so we'll give a longer grace period for diagnostics to catch up
6767
const hasErrors = currentDiagnostics.some(([_, diagnostics]) =>

0 commit comments

Comments
 (0)