fix(rules): route Kotlin script files to Kotlin review rules - #1091
fix(rules): route Kotlin script files to Kotlin review rules#1091Qiyuanqiii wants to merge 2 commits into
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
|
Can I review this? |
sure |
|
Some suggestion are out of range and cannot be put in the diff, I have submitted a pull request instead: |
Thanks for the follow‑up. I see that this PR addresses default exclusion parity for Kotlin test scripts, while #1091 is narrowly scoped to routing .kts files to the existing Kotlin rules. Since this changes file‑selection behavior, I think it would be better to keep it separate for independent review. What are your thoughts? |
|
Actually I thought about routing .kts to |
我是想分两个,你觉得麻烦的话我也可以合并了然后修改一下pr描述() |
|
我肯定觉得麻烦的,我自己的pr他还一个都没处理 |
Extend the default Kotlin test-path exclusion to `.kts` and add focused extension and exclusion regression coverage. Validated on the alibaba#1091 branch with `make check`, `make test`, `make coverage`, and the required OCR self-review. Co-authored-by: wu21-web <wu2196674@icloud.com>
|
@wu21-web Thanks for the follow-up contribution. I merged #13 into this branch, updated the PR description to cover both rule routing and default exclusion parity, and preserved your authorship and co-author credit in commit ca60521. I also reran make check, make test, make coverage, and the required OCR self-review on the integrated patch; all current-head GitHub checks are passing. |
wu21-web
left a comment
There was a problem hiding this comment.
Note sure if the rule docs need an update, but we might skip it for now.
Description
Summary
.ktand.ktsfiles to the existing built-inkotlin.mdreview rules..ktsfiles undersrc/test/**are excluded in the same way as.ktfiles.Root Cause and Integrated Fix
OpenCodeReview uses separate configuration layers for file reviewability, default exclusions, and built-in rule selection:
supported_file_types.jsonalready allows both.ktand.kts.default_exclude_patterns.jsonpreviously excluded**/src/test/**/*.kt, but not the corresponding.ktsfiles.system_rules.jsonpreviously mapped only**/*.{kt}tokotlin.md.That produced two inconsistencies:
default.md.src/test/**remained reviewable even though the equivalent.kttest source was excluded by default.app.ktkotlin.mdkotlin.mdscripts/setup.ktsdefault.mdkotlin.mdsrc/test/kotlin/FooTest.ktsrc/test/kotlin/scripts/FooTest.ktsdefault.mdRule Routing
The built-in Kotlin mapping now covers both extensions:
TestResolve_DefaultRulesresolvesscripts/setup.ktsand requires the Kotlin-specificNull Safetyguidance. The existing.ktcase remains in place.Default Exclusion Parity
The existing Kotlin test-source exclusion now covers Kotlin scripts as well:
The allowlist regression table explicitly covers
.kt,.KT,.kts, and.KTS. Exclusion cases verify that a nested.ktsfile undersrc/test/**is excluded while a.ktsfile undersrc/main/**remains eligible.Collaboration
ca6052117224978853d56f1194dcbb3d3f970f8bpreserves their GitHub authorship and includesCo-authored-by: wu21-web <wu2196674@icloud.com>.Compatibility and Scope
.ktrule resolution and default test exclusion are unchanged..ktsfiles now receive the already-shipped Kotlin rules instead of the generic default rules..ktsfiles undersrc/test/**are now excluded by default, matching the existing.ktbehavior.kotlin.mdare unchanged.Type of Change
How Has This Been Tested?
Validation Environment
go1.26.5 windows/amd64v24.14.0eda25482c74dff2f03bed2648497f23c512effe9(origin/main)b69402f9b0be7ae0ad916a61c259f14a5c75305bca6052117224978853d56f1194dcbb3d3f970f8bGNU Make is exposed as
mingw32-makeon this host. The unchanged Makefile targets were run with Git Bash and its Unix tools onPATH.Regression Coverage
scripts/setup.ktsfalls through todefault.md, which lacks the assertedNull Safetyguidance..ktand.ktspaths tokotlin.md..ktand.ktsinputs.src/test/kotlin/scripts/FooTest.ktsfromsrc/main/kotlin/scripts/Foo.kts.Final Validation
make checkpassed on the integrated patch: license headers, English-only validation,go mod tidy,gofmt -s -w ., andgo vetmake testpassed with the race detector across every non-extension Go packagemake coveragepassed at 90.9% overall;internal/config/allowlistwas 88.9% andinternal/config/ruleswas 91.7%git add --renormalize .introduced no unrelated line-ending changesgit diff --checkpassedf512adf9-0dd5-46fa-8825-42a09f94c0dc)OCR Coverage
OCR selected
default_exclude_patterns.jsonand reported 0 findings.allowed_ext_test.gowas skipped by the repository's default test-path filter, so the OCR result is not presented as coverage of both contributed files; the test change was reviewed directly and exercised by the full race-test and coverage runs.Checklist
go fmt,go vet)Known Limitations
.ktsfiles reuse the existing Kotlin rules; this change does not add separate Gradle Kotlin DSL guidance.src/test/**Kotlin convention and does not introduce new test-directory patterns.Related Issues and Contributions
Closes #1090.
Includes Qiyuanqiii/open-code-review#13 by @wu21-web.