mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-10-02 01:15:23 +08:00
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:
@@ -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__/**",
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -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` |
|
||||
|
||||
@@ -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` |
|
||||
|
||||
@@ -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` |
|
||||
|
||||
@@ -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` |
|
||||
|
||||
@@ -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` |
|
||||
|
||||
Reference in New Issue
Block a user