Skip to content

fix(cli): close Yarn Plug'n'Play and Kotlin Multiplatform gaps in please-style - #48

Merged
amondnet merged 6 commits into
mainfrom
amondnet/45-pnp-and-kmp-gaps
Oct 13, 2026
Merged

amondnet merged 6 commits into
mainfrom
amondnet/45-pnp-and-kmp-gaps

Conversation

@amondnet

@amondnet amondnet commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes the Yarn Plug'n'Play and Kotlin Multiplatform gaps in please-style (#45). Three commits, one per gap.

  1. please-style check under Yarn PnP (5dbcc90). Reproduced in a Yarn 4 PnP project: ast-grep exited 6 ("Cannot read configuration") because createRequire resolved @pleaseai/ast-grep-config/extract to a path inside a .yarn/cache zip. @pleaseai/ast-grep-config now sets "preferUnplugged": true, so Yarn installs it into .yarn/unplugged/. Verified end to end with freshly packed tarballs: yarn please-style check runs and reports findings.
  2. @pleaseai/editorconfig publishing and PnP handling (d75576d). The package was private: true and 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 in release-please.yml. Under PnP, init skips .editorconfig with a warning (en/ko) that gives yarn node -e "require('fs').copyFileSync(require.resolve('@pleaseai/editorconfig/.editorconfig'), '.editorconfig')" (verified under PnP). usesPlugNPlay now takes the installed path to check and is shared by both appliers.
  3. Kotlin Multiplatform source sets (7ee94f5). A module with src/commonMain/kotlin/ is KMP. Every src/<name>Test/kotlin/ is a test root and every src/<name>Main/kotlin/ a source root. Tests may target any *Main set (an iosTest may test an intermediate appleMain), which trades some orphan detection for no false positives. androidInstrumentedTest, androidAndroidTest, and integrationTest are excluded because they do not mirror sources. A *Test.kt inside a *Main set is reported as outside the test root. Non-KMP modules are unchanged.

Notes for reviewers

  • Deviation from please-style: Yarn Plug'n'Play gaps in editorconfig/check resolution and Kotlin Multiplatform source sets in jvmLayout #45: the helper check (test-helpers-in-dedicated-location) is not extended to KMP. It points shared helpers at src/testFixtures, which KMP lacks, so it would produce unfixable findings. This needs a standard decision first.
  • First npm publish of @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 test passes (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 --noEmit and eslint pass.
  • bun pm pack --dry-run of editorconfig includes .editorconfig.
  • PnP reproduction as described above.

Related issue

Closes #45

Checklist

  • PR title follows Conventional Commits
  • Packages build (bun run build)
  • Lint/format pass (bun run lint)
  • Documentation updated if behavior changed
  • No breaking change, or a BREAKING CHANGE: note is included

Summary by cubic

Closes the Yarn Plug'n'Play and Kotlin Multiplatform gaps in please-style (#45).

  • please-style check now works under Yarn Plug'n'Play: @pleaseai/ast-grep-config sets preferUnplugged, so Yarn installs it unpacked and ast-grep can read the rules.
  • @pleaseai/editorconfig was private: true and never published; it is now publishable and registered in release-please. Under PnP, init skips .editorconfig and prints a yarn node command that copies it via Yarn's resolver; the hint prints only when the file is missing, and the copy never overwrites an existing .editorconfig.
  • jvmLayout now recognizes Kotlin Multiplatform modules: a module with src/commonMain/kotlin/, or with src/<name>Main/kotlin/ sets and no classic src/main|test|testFixtures/kotlin/, is KMP. Each src/<name>Test/kotlin/ is a test root and each src/<name>Main/kotlin/ (or its java/ sibling) a source root; a test may target any *Main set. androidInstrumentedTest, androidAndroidTest, and integrationTest are excluded because they do not mirror sources, and a *Test.kt in a *Main set or in classic src/main/ is reported as outside the test root.

Rollout notes

  • The helper check test-helpers-in-dedicated-location is not extended to KMP; it skips multiplatform modules since they lack src/testFixtures, so findings would be unfixable.
  • This first-ever npm publish of @pleaseai/editorconfig may require a one-time manual publish or a trusted publisher on npmjs.com, since OIDC trusted publishing may not authorize a first release.
  • Merging triggers a release-please release (0.0.2).

Written for commit 6e97282. Summary will update on new commits.

Turn on auto-fix

… 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
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codacy-production

codacy-production Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 critical · 4 high

Alerts:
⚠ 6 issues (≤ 0 issues of at least minor severity)

Results:
6 new issues

Category Results
ErrorProne 1 high
Security 2 critical
3 high

View in Codacy

🟢 Metrics 39 complexity · 0 duplication

Metric Results
Complexity 39
Duplication 0

View in Codacy

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.

@amondnet
amondnet marked this pull request as ready for review October 13, 2026 03:07
@gemini-code-assist

Copy link
Copy Markdown

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
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying code-style with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

Review completed against the latest diff

Linked issue analysis

Linked issue: pleaseai/code-style#45: please-style: Yarn Plug'n'Play gaps in editorconfig/check resolution and Kotlin Multiplatform source sets in jvmLayout

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

Comment thread packages/cli/README.ko.md Outdated
Comment thread packages/cli/src/check/layouts.ts Outdated
Comment thread packages/cli/src/check/layouts.ts Outdated
Comment thread packages/cli/src/check/layouts.ts
Comment thread packages/cli/src/appliers.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

All reported issues were addressed across 14 files

Linked issue analysis

Linked issue: pleaseai/code-style#45: please-style: Yarn Plug'n'Play gaps in editorconfig/check resolution and Kotlin Multiplatform source sets in jvmLayout

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
Loading

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

Comment thread packages/cli/test/check/ast-grep.test.ts
Comment thread packages/cli/README.md Outdated
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue remains.

Summary

This PR adds Yarn Plug'n'Play support, makes @pleaseai/editorconfig publishable, and recognizes Kotlin Multiplatform source sets.

  • Yarn PnP projects can run please-style check.
  • PnP init guides users through adding .editorconfig.
  • Kotlin Multiplatform tests match sources across source sets.

Reviews (3) · Last reviewed commit: "fix(cli): report tests in src/main of a ..." · Reviewed by Greptile

Comment thread packages/cli/src/check/layouts.ts
Comment thread packages/cli/src/check/layouts.ts Outdated
Comment thread packages/cli/src/check/layouts.ts Outdated
Comment thread packages/cli/src/i18n.ts Outdated
…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
Comment thread packages/cli/src/check/layouts.ts Outdated
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
14.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@amondnet
amondnet merged commit 2ef3049 into main Oct 13, 2026
11 of 13 checks passed
@amondnet
amondnet deleted the amondnet/45-pnp-and-kmp-gaps branch October 13, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

please-style: Yarn Plug'n'Play gaps in editorconfig/check resolution and Kotlin Multiplatform source sets in jvmLayout

1 participant