Repository navigation
fix(cli): close Yarn Plug'n'Play and Kotlin Multiplatform gaps in please-style - #48
Conversation
… under Yarn PnP Yarn Plug'n'Play keeps packages in zip archives, which ast-grep cannot read. Marking the package preferUnplugged makes Yarn install it as a real directory. Refs #45
… PnP Register the package with release-please so it is published, and make init skip the .editorconfig copy under Yarn Plug'n'Play with a yarn node command that copies the file through Yarn's resolver. The README also documents that please-style check works under Plug'n'Play. Refs #45
…h check Treat src/<name>Test/kotlin sets as test roots and src/<name>Main/kotlin sets as source roots for modules with src/commonMain/kotlin. Refs #45
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 1 high |
| Security | 2 critical 3 high |
🟢 Metrics 39 complexity · 0 duplication
Metric Results Complexity 39 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Address SonarCloud S2871/S7780 and a Codacy unnecessary-condition finding in the Kotlin Multiplatform layout. Refs #45
Deploying code-style with
|
| Latest commit: |
6e97282
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ff4a1953.code-style.pages.dev |
| Branch Preview URL: | https://amondnet-45-pnp-and-kmp-gaps.code-style.pages.dev |
There was a problem hiding this comment.
cubic analysis
Review completed against the latest diff
Linked issue analysis
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Init writes or explains why it skips .editorconfig under PnP | The PnP branch warns with a Yarn command that resolves and copies the package file. |
| Please-style check works or gives actionable errors under PnP | The config package requests unplugged installation, but the added test checks that flag rather than using a PnP fixture. | |
| ✅ | KMP *Test sets map to source sets, with common and platform coverage | jvmLayout recognizes KMP roots, and the test covers commonTest plus platform test sets against Main sources. |
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 14 files
Linked issue analysis
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Write .editorconfig or explain the Plug'n'Play workaround | init warns under Plug'n'Play and prints a Yarn resolver command; the package is also made publishable. |
| Make please-style check work or fail clearly under Plug'n'Play | preferUnplugged addresses zip paths, but the added test checks package metadata rather than using a PnP fixture. | |
| ✅ | Use KMP *Test sets as roots for matching *Main sources | jvmLayout recognizes KMP test and source sets; tests cover commonTest and iosTest against commonMain and appleMain. |
Architecture diagram
sequenceDiagram
participant CLI as please-style CLI
participant FS as File System
participant PnP as Yarn PnP Runtime
participant AG as ast-grep
participant EC as editorconfig Package
participant KMP as Kotlin MPP Module
Note over CLI,FS: Init Flow - Editorconfig
CLI->>FS: Check node_modules/@pleaseai/editorconfig/.editorconfig
alt File exists
FS-->>CLI: File found
CLI->>FS: Copy to .editorconfig
CLI->>CLI: Record created
else File missing
FS-->>CLI: Not found
CLI->>PnP: Search for .pnp.cjs or .pnp.js in cwd/ancestors
alt PnP detected
CLI->>CLI: Log warning with yarn node copy command
end
CLI->>CLI: Record skipped
end
Note over CLI,AG: Check Flow - ast-grep
CLI->>FS: Check node_modules/@pleaseai/ast-grep-config/rules
alt Rules directory exists
FS-->>CLI: Rules found
CLI->>AG: Run check with sgconfig.yml
AG-->>CLI: Findings
else Rules missing
CLI->>PnP: Search for .pnp.cjs/.pnp.js
alt PnP detected
CLI->>AG: Use unplugged package path
AG->>FS: Read rules from .yarn/unplugged/
FS-->>AG: Rules loaded
AG-->>CLI: Findings
else No PnP
CLI->>CLI: Skip ast-grep check
end
end
Note over CLI,KMP: Check Flow - Kotlin MPP Detection
CLI->>KMP: Scan src/commonMain/kotlin/
alt KMP detected (commonMain exists)
CLI->>KMP: Enumerate src/*Test/kotlin/ sets
KMP-->>CLI: Test roots
CLI->>KMP: Enumerate src/*Main/kotlin/ sets
KMP-->>CLI: Source roots
CLI->>CLI: Match tests to any *Main set
alt Test in *Main set
CLI->>CLI: Report test-outside-root
end
alt Test with no matching source
CLI->>CLI: Report orphan-test
end
else Non-KMP module
CLI->>CLI: Use standard src/main|test layout
end
Requires human review: Auto-approval blocked because this review re-detected 2 unresolved issues already reported by Cubic.
Turn on auto-fix | Re-trigger cubic
|
…nfig hint - detect a multiplatform module without commonMain sources, and let its tests target Java sources of a *Main set - skip multiplatform modules in the helper check and report a test outside the test root only in src/main for non-multiplatform modules - print the Plug'n'Play editorconfig hint only when .editorconfig is missing, and copy with COPYFILE_EXCL so the command never overwrites it
|


Summary
Closes the Yarn Plug'n'Play and Kotlin Multiplatform gaps in
please-style(#45). Three commits, one per gap.please-style checkunder Yarn PnP (5dbcc90). Reproduced in a Yarn 4 PnP project: ast-grep exited 6 ("Cannot read configuration") becausecreateRequireresolved@pleaseai/ast-grep-config/extractto a path inside a.yarn/cachezip.@pleaseai/ast-grep-confignow sets"preferUnplugged": true, so Yarn installs it into.yarn/unplugged/. Verified end to end with freshly packed tarballs:yarn please-style checkruns and reports findings.@pleaseai/editorconfigpublishing and PnP handling (d75576d). The package wasprivate: trueand never published (npm 404), so the editorconfig tool could not install for anyone. It is now publishable (files, LICENSE, metadata), registered in the release-please config and manifest, and has a publish step inrelease-please.yml. Under PnP,initskips.editorconfigwith a warning (en/ko) that givesyarn node -e "require('fs').copyFileSync(require.resolve('@pleaseai/editorconfig/.editorconfig'), '.editorconfig')"(verified under PnP).usesPlugNPlaynow takes the installed path to check and is shared by both appliers.7ee94f5). A module withsrc/commonMain/kotlin/is KMP. Everysrc/<name>Test/kotlin/is a test root and everysrc/<name>Main/kotlin/a source root. Tests may target any*Mainset (aniosTestmay test an intermediateappleMain), which trades some orphan detection for no false positives.androidInstrumentedTest,androidAndroidTest, andintegrationTestare excluded because they do not mirror sources. A*Test.ktinside a*Mainset is reported as outside the test root. Non-KMP modules are unchanged.Notes for reviewers
test-helpers-in-dedicated-location) is not extended to KMP. It points shared helpers atsrc/testFixtures, which KMP lacks, so it would produce unfixable findings. This needs a standard decision first.@pleaseai/editorconfig: per the workflow's own comment, OIDC trusted publishing may not authorize a first-ever publish. The package may need a one-time manual publish, or a trusted publisher configured on npmjs.com beforehand. Merging this triggers a release-please release (0.0.2).Verification
packages/cli:bun testpasses (247 tests); the new tests fail on the old code.packages/ast-grep-config:ast-grep test(11 rules) and the e2e test (3) pass.tsc --noEmitand eslint pass.bun pm pack --dry-runof editorconfig includes.editorconfig.Related issue
Closes #45
Checklist
bun run build)bun run lint)BREAKING CHANGE:note is includedSummary by cubic
Closes the Yarn Plug'n'Play and Kotlin Multiplatform gaps in
please-style(#45).please-style checknow works under Yarn Plug'n'Play:@pleaseai/ast-grep-configsetspreferUnplugged, so Yarn installs it unpacked and ast-grep can read the rules.@pleaseai/editorconfigwasprivate: trueand never published; it is now publishable and registered in release-please. Under PnP,initskips.editorconfigand prints ayarn nodecommand that copies it via Yarn's resolver; the hint prints only when the file is missing, and the copy never overwrites an existing.editorconfig.jvmLayoutnow recognizes Kotlin Multiplatform modules: a module withsrc/commonMain/kotlin/, or withsrc/<name>Main/kotlin/sets and no classicsrc/main|test|testFixtures/kotlin/, is KMP. Eachsrc/<name>Test/kotlin/is a test root and eachsrc/<name>Main/kotlin/(or itsjava/sibling) a source root; a test may target any*Mainset.androidInstrumentedTest,androidAndroidTest, andintegrationTestare excluded because they do not mirror sources, and a*Test.ktin a*Mainset or in classicsrc/main/is reported as outside the test root.Rollout notes
test-helpers-in-dedicated-locationis not extended to KMP; it skips multiplatform modules since they lacksrc/testFixtures, so findings would be unfixable.@pleaseai/editorconfigmay require a one-time manual publish or a trusted publisher on npmjs.com, since OIDC trusted publishing may not authorize a first release.Written for commit 6e97282. Summary will update on new commits.