fix(rules): route Kotlin script files to Kotlin review rules (#1091)

* fix(rules): route Kotlin script files to Kotlin review rules

* fix(allowlist): exclude Kotlin script tests by default

Extend the default Kotlin test-path exclusion to `.kts` and add focused extension and exclusion regression coverage.

Validated on the #1091 branch with `make check`, `make test`, `make coverage`, and the required OCR self-review.

Co-authored-by: wu21-web <wu2196674@icloud.com>

---------

Co-authored-by: Tao Xin <wu2196674@icloud.com>
This commit is contained in:
祈愿Qiii
2026-09-05 21:47:39 +08:00
committed by GitHub
co-authored by wu21-web
parent 2190f11fcd
commit e967f3f4cf
9 changed files with 14 additions and 7 deletions
@@ -31,6 +31,10 @@ func TestIsAllowedExt(t *testing.T) {
{".ETS", true},
{".json5", true},
{".JSON5", true},
{".kt", true},
{".KT", true},
{".kts", true},
{".KTS", true},
{".ftl", true},
{".FTL", true},
{".ftlh", true},
@@ -146,6 +150,8 @@ func TestIsExcludedPath(t *testing.T) {
// Kotlin test directory
{"kotlin test dir", "src/test/kotlin/FooTest.kt", true},
{"kotlin main dir", "src/main/kotlin/Foo.kt", false},
{"kotlin scripts test dir", "src/test/kotlin/scripts/FooTest.kts", true},
{"kotlin scripts main dir", "src/main/kotlin/scripts/Foo.kts", false},
// JS/TS test files
{"js test file", "src/utils.test.js", true},
@@ -1,7 +1,7 @@
[
"**/*_test.go",
"**/src/test/java/**/*.java",
"**/src/test/**/*.kt",
"**/src/test/**/*.{kt,kts}",
"**/*.test.{js,jsx,ts,tsx}",
"**/*.spec.{js,jsx,ts,tsx}",
"**/__tests__/**",
+1 -1
View File
@@ -20,7 +20,7 @@
"**/*.ets": "arkts.md",
"**/*.astro": "astro.md",
"**/*.{ts,js,tsx,jsx,mjs,cjs}": "ts_js_tsx_jsx.md",
"**/*.{kt}": "kotlin.md",
"**/*.{kt,kts}": "kotlin.md",
"**/*.rs": "rust.md",
"**/*.{cpp,cc,cxx,hpp,hxx}": "cpp.md",
"**/*.c": "c.md",
@@ -94,6 +94,7 @@ func TestResolve_DefaultRules(t *testing.T) {
{"scripts/config.mjs", "TypeScript"},
{"server/bootstrap.cjs", "TypeScript"},
{"app.kt", "Null Safety"},
{"scripts/setup.kts", "Null Safety"},
{"src/main/handler.cpp", "Smart Pointer"},
{"src/main/handler.cxx", "Smart Pointer"},
{"include/handler.hxx", "Smart Pointer"},
+1 -1
View File
@@ -164,7 +164,7 @@ matching order:
| `**/*.ets` | `arkts.md` — ArkTS / HarmonyOS. |
| `**/*.astro` | `astro.md` — Astro components and islands. |
| `**/*.{ts,js,tsx,jsx,mjs,cjs}` | `ts_js_tsx_jsx.md` |
| `**/*.{kt}` | `kotlin.md` |
| `**/*.{kt,kts}` | `kotlin.md` |
| `**/*.rs` | `rust.md` |
| `**/*.R` | `r.md` |
| `**/*.{cpp,cc,cxx,hpp,hxx}` | `cpp.md` |
+1 -1
View File
@@ -126,7 +126,7 @@ OCR は [`bmatcuk/doublestar/v4`](https://pkg.go.dev/github.com/bmatcuk/doublest
| `**/*.ets` | `arkts.md`: ArkTS / HarmonyOS。 |
| `**/*.astro` | `astro.md`: Astro コンポーネントと islands。 |
| `**/*.{ts,js,tsx,jsx,mjs,cjs}` | `ts_js_tsx_jsx.md` |
| `**/*.{kt}` | `kotlin.md` |
| `**/*.{kt,kts}` | `kotlin.md` |
| `**/*.rs` | `rust.md` |
| `**/*.R` | `r.md` |
| `**/*.{cpp,cc,cxx,hpp,hxx}` | `cpp.md` |
+1 -1
View File
@@ -155,7 +155,7 @@ diff 단계에서 일어납니다.
| `**/*.ets` | `arkts.md` — ArkTS / HarmonyOS. |
| `**/*.astro` | `astro.md` — Astro 컴포넌트와 아일랜드. |
| `**/*.{ts,js,tsx,jsx,mjs,cjs}` | `ts_js_tsx_jsx.md` |
| `**/*.{kt}` | `kotlin.md` |
| `**/*.{kt,kts}` | `kotlin.md` |
| `**/*.rs` | `rust.md` |
| `**/*.R` | `r.md` |
| `**/*.{cpp,cc,cxx,hpp,hxx}` | `cpp.md` |
+1 -1
View File
@@ -166,7 +166,7 @@ OCR использует [`bmatcuk/doublestar/v4`](https://pkg.go.dev/github.com
| `**/*.ets` | `arkts.md` — ArkTS / HarmonyOS. |
| `**/*.astro` | `astro.md` — компоненты и islands Astro. |
| `**/*.{ts,js,tsx,jsx,mjs,cjs}` | `ts_js_tsx_jsx.md` |
| `**/*.{kt}` | `kotlin.md` |
| `**/*.{kt,kts}` | `kotlin.md` |
| `**/*.rs` | `rust.md` |
| `**/*.R` | `r.md` |
| `**/*.{cpp,cc,cxx,hpp,hxx}` | `cpp.md` |
+1 -1
View File
@@ -147,7 +147,7 @@ OCR 用 [`bmatcuk/doublestar/v4`](https://pkg.go.dev/github.com/bmatcuk/doublest
| `**/*.ets` | `arkts.md`——ArkTS / HarmonyOS。 |
| `**/*.astro` | `astro.md`——Astro 组件与 islands。 |
| `**/*.{ts,js,tsx,jsx,mjs,cjs}` | `ts_js_tsx_jsx.md` |
| `**/*.{kt}` | `kotlin.md` |
| `**/*.{kt,kts}` | `kotlin.md` |
| `**/*.rs` | `rust.md` |
| `**/*.R` | `r.md` |
| `**/*.{cpp,cc,cxx,hpp,hxx}` | `cpp.md` |