Fix artisan make imports to use full go module path#1422
Conversation
Co-authored-by: hwbrzzl <24771476+hwbrzzl@users.noreply.github.com> Agent-Logs-Url: https://github.com/goravel/framework/sessions/58bd8335-9bd8-461b-b80e-a493dd9e4dc2
Co-authored-by: hwbrzzl <24771476+hwbrzzl@users.noreply.github.com> Agent-Logs-Url: https://github.com/goravel/framework/sessions/58bd8335-9bd8-461b-b80e-a493dd9e4dc2
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1422 +/- ##
=======================================
Coverage 67.97% 67.97%
=======================================
Files 354 354
Lines 27521 27522 +1
=======================================
+ Hits 18708 18709 +1
Misses 7964 7964
Partials 849 849 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThe changes fix an issue where Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/paths/paths_test.go (1)
444-450: Consider adding a test case for Windows-style main path.The implementation at Line 131 in
paths.gohandles backslashes inr.main, but there's no corresponding test case. While module paths fromgo.modare unlikely to contain backslashes, adding a test would ensure this edge case is covered.🧪 Optional test case to add
{ name: "with windows-style path", path: "app\\http\\controllers", main: "github.com/goravel/goravel", isModule: false, expected: "github.com/goravel/goravel/app/http/controllers", }, + { + name: "with windows-style main path", + path: "app/http/controllers", + main: "github.com\\goravel\\goravel", + isModule: false, + expected: "github.com/goravel/goravel/app/http/controllers", + }, { name: "with complex main path",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/paths/paths_test.go` around lines 444 - 450, Add a unit test row to the existing table in packages/paths/paths_test.go that covers a Windows-style main containing backslashes so we verify the code path that normalizes backslashes in r.main (the logic introduced in paths.go that replaces backslashes). Create a test case similar to the existing "with windows-style path" entry but set main to a backslash-containing value (e.g., "github\\com\\goravel\\goravel") and assert expected uses forward-slashes (e.g., "github.com/goravel/goravel/app/http/controllers"); keep the same fields (name, path, main, isModule, expected) so the table-driven test picks it up.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/paths/paths_test.go`:
- Around line 444-450: Add a unit test row to the existing table in
packages/paths/paths_test.go that covers a Windows-style main containing
backslashes so we verify the code path that normalizes backslashes in r.main
(the logic introduced in paths.go that replaces backslashes). Create a test case
similar to the existing "with windows-style path" entry but set main to a
backslash-containing value (e.g., "github\\com\\goravel\\goravel") and assert
expected uses forward-slashes (e.g.,
"github.com/goravel/goravel/app/http/controllers"); keep the same fields (name,
path, main, isModule, expected) so the table-driven test picks it up.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 615bf801-9f0c-424c-ac57-d25e93d8d6ad
⛔ Files ignored due to path filters (1)
tests/go.sumis excluded by!**/*.sum
📒 Files selected for processing (3)
packages/paths/paths.gopackages/paths/paths_test.gotests/go.mod
artisan make:*generation was building non-module imports from only the last segment ofgo.modmodule path (e.g.backend/...), which breaks projects using nested/private module paths (e.g.git.site.com/path/backend/...). This change aligns generated imports with the full declared module path.Import path resolution
packages/paths.Path.Import()to use the full normalizedmainmodule path as the prefix for non-module paths.isModulebehavior: framework module paths are still returned as-is.Behavioral contract updates (tests)
packages/paths/paths_test.goexpectations to validate full-module imports across:App,Config,Facades, etc.),gitlab.com/..., internal domains).Original prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.
Summary by CodeRabbit
Bug Fixes
Tests
Chores