-
-
Notifications
You must be signed in to change notification settings - Fork 40
Add FieldConstantUsageTask to replace string fields with entity constants #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ants This task automatically replaces string field names with entity FIELD_* constants in Table class queries. It targets specific query builder methods (select, where, orderBy, groupBy, etc.) and only replaces strings when the corresponding entity has a matching constant. Addresses #389 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 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 |
- Group methods by class (SelectQuery, Validator, RulesChecker) - Track variable types from method parameters - Check context before replacing to reduce false positives
|
One idea would be to separate this into "refactor" which we know can be "false positive", and keep the actual task "safe": $commands->add('illuminate code', IlluminateCommand::class);
$commands->add('illuminate refactor', RefactorCommand::class); |
|
@rochamarcelo And "refactor" should always run after "code" |
|
I agree, having a refactor can avoid issues and don't change the original behavior. |
|
Do you want make a 2nd command here and use this as first task? |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #405 +/- ##
==========================================
Coverage 84.51% 84.51%
- Complexity 2044 2109 +65
==========================================
Files 121 122 +1
Lines 5560 5735 +175
==========================================
+ Hits 4699 4847 +148
- Misses 861 888 +27 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Yes, I can take a look into this. |
Summary
This PR adds a new illuminator task that automatically replaces string field names with entity
FIELD_*constants in Table class queries.Addresses #389
What it does
select,where,orderBy,groupBy, etc.)usestatement for the entity classExample
Before:
After:
Limitations (documented)
Wheels.name) to avoid false positives with joinsilluminateforEntityFieldTaskfirst)Configuration
The task supports custom method configuration via
IdeHelper.illuminatorTasksconfig if needed.Test plan
FieldConstantUsageTask🤖 Generated with Claude Code