Skip to content

Commit 7ba4c9e

Browse files
authored
Add a linter for proto files (RooCodeInc#4179)
* Add a protobuf linter Enforce the standard lint rules: snake case field names, snake case file names, pascal case service names etc. Add exceptions for the lint rules we are already not following. Fix linter failures, this only changes the proto file The generated TS types are the same, so the ts files don't need to be updated. * Formatting
1 parent 802e72f commit 7ba4c9e

File tree

6 files changed

+238
-6
lines changed

6 files changed

+238
-6
lines changed

buf.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: v2
2+
modules:
3+
- path: proto
4+
name: cline/cline/lint
5+
6+
lint:
7+
use:
8+
- STANDARD
9+
10+
except: # Add exceptions for current patterns that contradict STANDARD settings
11+
- RPC_PASCAL_CASE # rpcs are camel case (start with lowercase)
12+
- PACKAGE_DIRECTORY_MATCH # the protos in the cline package are not in a dir named cline.
13+
- RPC_REQUEST_RESPONSE_UNIQUE # request messages are not unique.
14+
- RPC_REQUEST_STANDARD_NAME # request messages dont all end with Request
15+
- RPC_RESPONSE_STANDARD_NAME # response messages dont all end with Response
16+
- PACKAGE_VERSION_SUFFIX # package name does not contain version.
17+
- ENUM_VALUE_PREFIX # enum values dont start with the enum name.
18+
- ENUM_ZERO_VALUE_SUFFIX # first value does not have to be UNSPECIFIED.
19+
20+
# breaking:
21+
# use:
22+
# - WIRE_JSON # Detect changes that break the json wire format (this is the minimum recommended level.)

package-lock.json

Lines changed: 209 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
"watch-tests": "tsc -p . -w --outDir out",
337337
"pretest": "npm run compile-tests && npm run compile && npm run compile-standalone && npm run lint",
338338
"check-types": "npm run protos && tsc --noEmit",
339-
"lint": "eslint src --ext ts && eslint webview-ui/src --ext ts && cd webview-ui && npm run lint",
339+
"lint": "eslint src --ext ts && eslint webview-ui/src --ext ts && buf lint && cd webview-ui && npm run lint",
340340
"format": "prettier . --check",
341341
"format:fix": "prettier . --write",
342342
"test": "npm-run-all test:unit test:integration",
@@ -364,6 +364,7 @@
364364
]
365365
},
366366
"devDependencies": {
367+
"@bufbuild/buf": "^1.54.0",
367368
"@changesets/cli": "^2.27.12",
368369
"@types/chai": "^5.0.1",
369370
"@types/clone-deep": "^4.0.4",

proto/host/uri.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ message Uri {
2525
string path = 3;
2626
string query = 4;
2727
string fragment = 5;
28-
string fsPath = 6;
28+
string fs_path = 6;
2929
}
3030

3131
// Request for joining path segments to a URI
3232
message JoinPathRequest {
3333
cline.Metadata metadata = 1;
3434
Uri base = 2;
35-
repeated string pathSegments = 3;
35+
repeated string path_segments = 3;
3636
}

proto/models.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ message OpenRouterCompatibleModelInfo {
8585
// Request for fetching OpenAI models
8686
message OpenAiModelsRequest {
8787
Metadata metadata = 1;
88-
string baseUrl = 2;
89-
string apiKey = 3;
88+
string base_url = 2;
89+
string api_key = 3;
9090
}
9191

9292
// Request for updating API configuration

proto/ui.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum WebviewProviderType {
1515
// Define a new message type for webview provider info
1616
message WebviewProviderTypeRequest {
1717
Metadata metadata = 1;
18-
WebviewProviderType providerType = 2;
18+
WebviewProviderType provider_type = 2;
1919
}
2020

2121
// Enum for ClineMessage type

0 commit comments

Comments
 (0)