Skip to content

Commit 2175687

Browse files
committed
style: Lint fix
--story=1
1 parent 12de53d commit 2175687

28 files changed

+253
-240
lines changed

.codei18n/mappings.json

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@
6363
"en": "// Or better: Sort tasks by direction before batching.",
6464
"zh-CN": "// 或者:在批量之前对任务进行排序。"
6565
},
66-
"0464999d6422e031d4c754e98f0ed0238fa0a36f": {
67-
"en": "// Returns a list of domain.Comment objects containing the comment text, location, and context symbols.",
68-
"zh-CN": "// 返回包含注释文本、位置和上下文符号的 domain.Comment 列表"
69-
},
7066
"046c00251ed8e0048dfc1298ec79500a6a403deb": {
7167
"en": "//",
7268
"zh-CN": "//\n```"
7369
},
70+
"049f10f32e71ac571ff1ca95afd0da90516b24da": {
71+
"en": "// Adapter implements the LanguageAdapter interface in Java.",
72+
"zh-CN": "// Adapter 实现 Java 语言的 LanguageAdapter 接口"
73+
},
7474
"04ab7b1f75eee005fe16d83c18d2cb94bac80bbc": {
7575
"en": "// Save progress immediately",
7676
"zh-CN": "// 立即保存进度"
@@ -455,10 +455,6 @@
455455
"en": "// LanguageAdapter defines the interface for language-specific AST parsers",
456456
"zh-CN": "// LanguageAdapter 定义了语言特定的 AST 解析器的接口"
457457
},
458-
"1c6c3bd6bed40c55a529e8a5ea20e34223005494": {
459-
"en": "// Language returns the language identifier (\"java\")",
460-
"zh-CN": "// Language 返回语言标识符 (\"java\")"
461-
},
462458
"1c9e9b6fbcf2a701fff0f9da334131d2937e4550": {
463459
"en": "// For Java, the symbol path format is: package.ClassName#methodName or package.ClassName#fieldName",
464460
"zh-CN": "// 对于 Java,符号路径格式为:package.ClassName#methodName 或 package.ClassName#fieldName"
@@ -475,6 +471,10 @@
475471
"en": "// Parse",
476472
"zh-CN": "// 解析"
477473
},
474+
"1d4024454f544bdf6d77ee20e21cde8db7735691": {
475+
"en": "// NewAdapter creates a new Java adapter instance",
476+
"zh-CN": "// NewAdapter 创建一个新的 Java 适配器实例"
477+
},
478478
"1d49c2b4a5ea4f7f1b8f494c4ed02a6892a0354d": {
479479
"en": "// Skip .git, vendor, .codei18n",
480480
"zh-CN": "// 跳过 .git, vendor, .codei18n"
@@ -667,10 +667,6 @@
667667
"en": "// Search for matching Chinese text in the mapping",
668668
"zh-CN": "// 在映射中查找匹配的中文文本"
669669
},
670-
"2abebba44e8db929c05d11b8e4f554869b2fc0cb": {
671-
"en": "// Adapter implements the LanguageAdapter interface in Java.",
672-
"zh-CN": "// Adapter 实现 Java 语言的 LanguageAdapter 接口"
673-
},
674670
"2ac6a603d607e405a251768b5d75c44ad95396f1": {
675671
"en": "// If direction changes in batch, we can't batch efficiently.",
676672
"zh-CN": "// 如果批量中方向发生变化,则无法高效地进行批处理。"
@@ -755,6 +751,10 @@
755751
"en": "// 2. Generate IDs",
756752
"zh-CN": "// 2. 生成 ID"
757753
},
754+
"301ab8d44d67c6b22ce7e7a244bb7ece47ff9561": {
755+
"en": "// Initialize the Tree-sitter parser and load the Java grammar",
756+
"zh-CN": "// 初始化 Tree-sitter 解析器并加载 Java 语法"
757+
},
758758
"302a4dc855ac27653854796f073aa82bf20e6c94": {
759759
"en": "// Case 1: Comments inside string literals should NOT be extracted",
760760
"zh-CN": "// 案例 1:字符串字面量内部的注释不应被提取"
@@ -783,10 +783,6 @@
783783
"en": "// Now you can reverse lookup English text through Chinese text.",
784784
"zh-CN": "// 现在验证可以通过中文文本反向查找英文"
785785
},
786-
"31c6351c8c5b360cd63bc1e0e5797b6876051daa": {
787-
"en": "// Normalize the text and identify comment types",
788-
"zh-CN": "// 规范化文本并识别注释类型"
789-
},
790786
"32034fa8ff84af1aacb96c29502abf938ee1ace4": {
791787
"en": "// If a model is specified via the command line, it overrides the model in the configuration",
792788
"zh-CN": "// 如果通过命令行指定了模型,则会覆盖配置中的模型"
@@ -847,6 +843,10 @@
847843
"en": "// Rule: SHA1(file_path + language + parent_symbol + normalized_text)",
848844
"zh-CN": "// 规则:SHA1(file_path + language + parent_symbol + normalized_text)"
849845
},
846+
"3563208344f880b815fca7d376ee1f23696d2020": {
847+
"en": "// Normalize the text and identify comment types",
848+
"zh-CN": "// 规范化文本并识别注释类型"
849+
},
850850
"356d6dbacbe459a332d51bd7b39a7bc646b74543": {
851851
"en": "// 4. //! Module Doc -\u003e Owner is mod my_mod -\u003e Path \"my_mod\"",
852852
"zh-CN": "// 4. //! 模块文档 -\u003e 拥有者为 mod my_mod -\u003e 路径 \"my_mod\""
@@ -943,10 +943,6 @@
943943
"en": "// Continue scanning other files",
944944
"zh-CN": "// 继续扫描其他文件"
945945
},
946-
"3b0922ac632530145f45465570706d3af713bfd2": {
947-
"en": "// First, extract the package name",
948-
"zh-CN": "// 首先提取包名"
949-
},
950946
"3b0cc0654043ee485c8868a2263c7a532e982d30": {
951947
"en": "// But let's check strict content if possible or just existence.",
952948
"zh-CN": "// 但如果可能,请检查严格内容或仅检查存在性。"
@@ -1111,6 +1107,10 @@
11111107
"en": "// Rule: SHA1(file_path + language + symbol + normalized_text)",
11121108
"zh-CN": "// 规则:SHA1(file_path + language + symbol + normalized_text)"
11131109
},
1110+
"44aa6f484383b4042a04c3f6d1de34e04a6bba5d": {
1111+
"en": "// Returns a list of domain.Comment objects containing the comment text, location, and context symbols.",
1112+
"zh-CN": "// 返回包含注释文本、位置和上下文符号的 domain.Comment 列表"
1113+
},
11141114
"44bd8e1f66387ea67c11f7ff9950f9416504c65e": {
11151115
"en": "// \"// Create a decorator type to hide the original comment and display the translation in front of it\" should be on the second line",
11161116
"zh-CN": "// \"// 创建一个装饰类型,将原始注释隐藏并在前面显示翻译\" 应该在第 2 行"
@@ -1255,10 +1255,6 @@
12551255
"en": "// Or we can check if file mod time changed if the tool is smart,",
12561256
"zh-CN": "// 或者我们可以检查如果工具足够智能,文件修改时间是否发生了改变。"
12571257
},
1258-
"51fc1bff44817793e3b4ae76b54b3e069ecdcfc0": {
1259-
"en": "// If src is nil, read the source code from the file path.",
1260-
"zh-CN": "// 如果 src 为 nil,则从文件路径读取源代码"
1261-
},
12621258
"522c9f7d2175ea4967fb68cf29be69efcedbb1b6": {
12631259
"en": "// Expect additions",
12641260
"zh-CN": "// 预期有新增内容"
@@ -1571,6 +1567,10 @@
15711567
"en": "// Note: We want to capture comments. In tree-sitter, comments are often extra nodes ",
15721568
"zh-CN": "// 注意:我们想要捕获注释。在 tree-sitter 中,注释通常是额外的节点"
15731569
},
1570+
"6d74752615a35527b4dbf52368e23fb4d08c72e9": {
1571+
"en": "// Language returns the language identifier (\"java\")",
1572+
"zh-CN": "// Language 返回语言标识符 (\"java\")"
1573+
},
15741574
"6d88b3ae5272f5cd85e9f11c4ff8af4a758a2d04": {
15751575
"en": "// 2. Apply flags",
15761576
"zh-CN": "// 2. 应用标志"
@@ -1947,6 +1947,10 @@
19471947
"en": "// Should be strictly separated from preceding block comment",
19481948
"zh-CN": "// 应严格与前置代码块注释分开"
19491949
},
1950+
"89b0fda5bd6bf5eed7d9c6d586a02276012f91a9": {
1951+
"en": "// Parse the symbol path",
1952+
"zh-CN": "// 解析符号路径"
1953+
},
19501954
"8a8c9068221c799a3fef1291306c666b82b36fe4": {
19511955
"en": "// Already converted to Chinese content",
19521956
"zh-CN": "// 已经转换为中文的内容"
@@ -2127,6 +2131,10 @@
21272131
"en": "//",
21282132
"zh-CN": "//\n```\n//\n```"
21292133
},
2134+
"9518a289a94d2d7336dee805fe938d97f5a1003f": {
2135+
"en": "// Create query",
2136+
"zh-CN": "// 创建查询"
2137+
},
21302138
"955b1f2952d2aa3ef9dbf82e2c4449f20a73aa05": {
21312139
"en": "// 2. Verify Inline comment",
21322140
"zh-CN": "// 2. 验证内联注释"
@@ -2215,10 +2223,6 @@
22152223
"en": "// Default to package level",
22162224
"zh-CN": "// 默认为包级"
22172225
},
2218-
"9a1b2a617ee612f8c695c0b55af43a7dd3443667": {
2219-
"en": "// Initialize the Tree-sitter parser and load the Java grammar",
2220-
"zh-CN": "// 初始化 Tree-sitter 解析器并加载 Java 语法"
2221-
},
22222226
"9a477664ddd5e6c0764c480fb8a11f42d4e05bdb": {
22232227
"en": "// Validate comment type and tag",
22242228
"zh-CN": "// 验证注释类型和标记"
@@ -2363,6 +2367,10 @@
23632367
"en": "// 2. Run tests",
23642368
"zh-CN": "// 2. 运行测试"
23652369
},
2370+
"a59655c6bff0a6f6329a735ef1d0e7bc07fa8eae": {
2371+
"en": "// Parse the provided Java source code and extract comments",
2372+
"zh-CN": "// Parse 解析提供的 Java 源代码并提取注释"
2373+
},
23662374
"a59b196601d76c702962a523b610f1618371973f": {
23672375
"en": "// Calculate offsets",
23682376
"zh-CN": "// 计算偏移量"
@@ -2471,10 +2479,6 @@
24712479
"en": "// Since verbose is on (flag passed to binary? --verbose is global flag).",
24722480
"zh-CN": "// 由于 verbose 开启 (标志是否通过二进制传递? --verbose 是全局标志)。"
24732481
},
2474-
"b0a58f194c759355eac4ddf8fcdb9c1b05edb90d": {
2475-
"en": "// Create query",
2476-
"zh-CN": "// 创建查询"
2477-
},
24782482
"b0b280a5cca8bfb1357e1ba38e80c6872926c538": {
24792483
"en": "/**\n * A calculator class\n */",
24802484
"zh-CN": "/**\n * 一个计算器类\n */"
@@ -2611,6 +2615,10 @@
26112615
"en": "// Apply Mode (EN -\u003e ZH)",
26122616
"zh-CN": "// 应用模式 (EN -\u003e ZH)"
26132617
},
2618+
"ba454cf85b190b52a07fa730b759907c0db41f98": {
2619+
"en": "// extractComments extracts comments from the parse tree",
2620+
"zh-CN": "// extractComments 从语法树中提取注释"
2621+
},
26142622
"baac245448732d3431de11bfcbf5cefeae29cc51": {
26152623
"en": "// OR I update the test to generate IDs and put them in store.",
26162624
"zh-CN": "// 或者我更新测试以生成ID并将它们存储起来。"
@@ -2935,10 +2943,6 @@
29352943
"en": "// The smacker/go-tree-sitter javascript grammar usually handles JSX.",
29362944
"zh-CN": "// The smacker/go-tree-sitter javascript grammar usually handles JSX."
29372945
},
2938-
"cdbceab78c4d9094110be7dd1eb20c5de89dcb39": {
2939-
"en": "// extractComments extracts comments from the parse tree",
2940-
"zh-CN": "// extractComments 从语法树中提取注释"
2941-
},
29422946
"ce1eac4e2ce4747154ed445911623102b8260d44": {
29432947
"en": "// Override at build time via -ldflags \"-X main.version=\u003cversion\u003e\"",
29442948
"zh-CN": "// 通过 -ldflags 参数在构建时覆盖,例如:-X main.version=\u003c版本\u003e"
@@ -3107,10 +3111,6 @@
31073111
"en": "// c.SourceText is EN",
31083112
"zh-CN": "// c.SourceText 是 EN"
31093113
},
3110-
"da979dcb9aaf1d8c472ba49e26590c901eb5aa3c": {
3111-
"en": "// Parse the symbol path",
3112-
"zh-CN": "// 解析符号路径"
3113-
},
31143114
"daaafcd2f090cf4bf63fbf85cb2f16d690521885": {
31153115
"en": "// 3. Execute CLI: codei18n scan --file simple.go --format json",
31163116
"zh-CN": "// 3. 执行 CLI: codei18n scan --file simple.go --format json"
@@ -3143,10 +3143,6 @@
31433143
"en": "// 2. Install hook",
31443144
"zh-CN": "// 2. 安装钩子"
31453145
},
3146-
"dd43ecf8cf35aa31bb85b3818d494207c32c3923": {
3147-
"en": "// Parse the provided Java source code and extract comments",
3148-
"zh-CN": "// Parse 解析提供的 Java 源代码并提取注释"
3149-
},
31503146
"dd5e5dec26681ea7a848b8c70bb2f9f9ff63740e": {
31513147
"en": "// MappingStore defines the interface for managing mapping files",
31523148
"zh-CN": "// MappingStore 定义了管理映射文件的接口"
@@ -3159,10 +3155,6 @@
31593155
"en": "// GetBinaryPath returns the path to the pre-built binary",
31603156
"zh-CN": "// GetBinaryPath 返回预构建二进制文件的路径"
31613157
},
3162-
"de82f58f582b27517dd8dce56fc11c5d3a3ff2ac": {
3163-
"en": "// Use Tree-sitter to parse Java source code and extract comments and their context",
3164-
"zh-CN": "// 使用 Tree-sitter 解析 Java 源代码并提取注释及其上下文"
3165-
},
31663158
"debbc2c39bb4e12e07cc2f2a1f0e46bc4604cb04": {
31673159
"en": "// Simulate content converted to Chinese.",
31683160
"zh-CN": "// 模拟已转换为中文的内容"
@@ -3203,6 +3195,10 @@
32033195
"en": "// 6. Block comment (lines 9-10)",
32043196
"zh-CN": "// 6. 块注释 (第 9-10 行)"
32053197
},
3198+
"e0f10e7d998a9fb9b1263ab4e95ae267bc84ee39": {
3199+
"en": "// If src is nil, read the source code from the file path.",
3200+
"zh-CN": "// 如果 src 为 nil,则从文件路径读取源代码"
3201+
},
32063202
"e164f3d80351c71e1b31b93b14b1c1d0b3e7db61": {
32073203
"en": "// RustContent includes Rust-specific doc comments",
32083204
"zh-CN": "// RustContent 包括 Rust 特定的文档注释"
@@ -3299,6 +3295,10 @@
32993295
"en": "// We can try to unmarshal it",
33003296
"zh-CN": "// 我们可以尝试去解压它"
33013297
},
3298+
"e6a63c8cf78cb605c9562dd172d349f180ab3ddc": {
3299+
"en": "// First, extract the package name",
3300+
"zh-CN": "// 首先提取包名"
3301+
},
33023302
"e6c90d3b5fb921d594c253cf957f48bb8f14edbe": {
33033303
"en": "// Find comment, get translation, replace.",
33043304
"zh-CN": "// 查找注释,获取翻译,替换。"
@@ -3483,10 +3483,6 @@
34833483
"en": "// Fallback to parent if no sibling found (orphaned doc comment)",
34843484
"zh-CN": "// 如果未找到兄弟节点,则回退到父节点 (孤立文档注释)"
34853485
},
3486-
"f30b8a8353464e1f1e44ee40882c2466bb75e350": {
3487-
"en": "// NewAdapter creates a new Java adapter instance",
3488-
"zh-CN": "// NewAdapter 创建一个新的 Java 适配器实例"
3489-
},
34903486
"f33451ac345da8d60c1fcd06bc93aff01b04fdc3": {
34913487
"en": "// +1 for newline",
34923488
"zh-CN": "// +1 for newline"
@@ -3591,6 +3587,10 @@
35913587
"en": "// Common parser behavior: \"Line 1\" and \"Line 2\" are separate unless doc comment.",
35923588
"zh-CN": "// 常见解析器行为: \"Line 1\"\"Line 2\" 在没有文档注释的情况下才被视为单独的行。"
35933589
},
3590+
"fa608a87b5074f1740c59ab495c58a5824c2b474": {
3591+
"en": "// Use Tree-sitter to parse Java source code and extract comments and their context",
3592+
"zh-CN": "// 使用 Tree-sitter 解析 Java 源代码并提取注释及其上下文"
3593+
},
35943594
"faff98fb150ad1d7d04ffd884e616aa21500a3b4": {
35953595
"en": "// queryTS is a tree-sitter query to find comments in TypeScript/JavaScript",
35963596
"zh-CN": "// queryTS 是一个 tree-sitter 查询,用于查找 TypeScript/JavaScript 中的注释"

.github/workflows/ci.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,11 @@ jobs:
2626
go mod download
2727
go mod verify
2828
29-
- name: 运行 gofmt 检查
30-
run: |
31-
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
32-
echo "以下文件需要格式化:"
33-
gofmt -s -l .
34-
exit 1
35-
fi
36-
37-
- name: 运行 go vet
38-
run: go vet ./...
39-
40-
- name: 安装 staticcheck
41-
run: go install honnef.co/go/tools/cmd/staticcheck@latest
42-
43-
- name: 运行 staticcheck
44-
run: staticcheck ./...
29+
- name: 运行 golangci-lint
30+
uses: golangci/golangci-lint-action@v6
31+
with:
32+
version: latest
33+
args: --timeout=5m
4534

4635
# 构建测试(多平台)
4736
build:

.golangci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
run:
2+
timeout: 5m
3+
modules-download-mode: readonly
4+
5+
linters:
6+
disable-all: true
7+
enable:
8+
- gosimple
9+
- govet
10+
- ineffassign
11+
- staticcheck
12+
- typecheck
13+
- unused
14+
- gofmt
15+
- goimports
16+
17+
linters-settings:
18+
gofmt:
19+
simplify: true
20+
goimports:
21+
local-prefixes: github.com/studyzy/codei18n
22+
23+
issues:
24+
exclude-use-default: false
25+
max-issues-per-linter: 0
26+
max-same-issues: 0

0 commit comments

Comments
 (0)