Add new sniff to remove wpdb prefix from FrmDb functions#2794
Conversation
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Database Query Updates classes/models/FrmEntry.php, classes/models/FrmForm.php, classes/views/xml/forms_xml.php |
Removed explicit $wpdb->prefix concatenation from FrmDb method calls (get_var, get_col, get_results), replacing patterns like $wpdb->prefix . 'frm_items' with bare table names like 'frm_items' (6 instances across 3 files) |
Code Analysis Sniff phpcs-sniffs/Formidable/Sniffs/CodeAnalysis/RemoveRedundantWpdbPrefixSniff.php |
New sniff class implementing detection and auto-fix for redundant $wpdb->prefix usage in FrmDb calls; includes register() and process() methods with token-based pattern matching and removal logic |
PHPCS Configuration phpcs.xml |
Registered new sniff rule Formidable.CodeAnalysis.RemoveRedundantWpdbPrefix in ruleset |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~12 minutes
Suggested labels
run analysis, run tests
Poem
🐰 A sniff hops through the code with glee,
Removing prefixes, wild and free,
Where\$wpdbonce danced with strings so long,
Now simple names sing out their song,
Clean and lean, the tables align! ✨
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Title check | ✅ Passed | The pull request title accurately describes the main objective: introducing a new CodeSniffer sniff that detects and removes redundant wpdb prefix usage in FrmDb functions. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
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 @coderabbitai help to get the list of available commands and usage tips.
…_prefix_from_frmdb_functions Add new sniff to remove wpdb prefix from FrmDb functions
Summary by CodeRabbit
Chores
✏️ Tip: You can customize this high-level summary in your review settings.