Add php codesniffer baseline for cyclomatic complexity#2747
Conversation
WalkthroughThis PR adds PHPCS lint suppression comments to four methods across helper and controller classes to suppress cyclomatic complexity warnings. No functional logic or control flow modifications are introduced. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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.
Actionable comments posted: 0
🧹 Nitpick comments (4)
classes/helpers/FrmXMLHelper.php (1)
1294-1377: Cyclomatic-complexity ignore is safe and keeps tooling noise downThe added
Generic.Metrics.CyclomaticComplexity.MaxExceededsuppression onpopulate_postmeta()only affects PHPCS and leaves behavior unchanged. Given how specialized and deeply branched this import logic already is, this is a reasonable baseline; longer term, consider extracting a few smaller helpers from the largefrm_optionsbranch if you decide to reduce complexity rather than rely on ignores.classes/controllers/FrmFormsController.php (1)
2095-2192: route() cyclomatic-complexity suppression is fine; consider future decompositionExtending the existing PHPCS ignore on
route()to coverGeneric.Metrics.CyclomaticComplexity.MaxExceededis a tooling-only change and doesn’t affect runtime. Given how much dispatch and request-shaping lives here, leaning on a complexity ignore is reasonable; over time, you might factor out the JSON-compaction handling and the action switch into smaller helpers to keep this router more maintainable.classes/helpers/FrmFormsHelper.php (1)
108-236: form_switcher() complexity ignore matches intent of this PRAdding the extra PHPCS ignore for
Generic.Metrics.CyclomaticComplexity.MaxExceededis consistent with the existing cognitive-complexity suppression and doesn’t alter behavior. Given the number of context-specific branches (entries page, styles page, views, etc.), this is a sensible way to get PHPCS clean; if you touch this again, consider extracting the base-URL /$argsresolution into a small helper to trim the complexity without changing behavior.classes/helpers/FrmListHelper.php (1)
959-1059: print_column_headers() PHPCS suppression is non-functional and acceptableThe added
Generic.Metrics.CyclomaticComplexity.MaxExceededsuppression onprint_column_headers()only affects PHPCS and keeps this WP-core-style header logic intact. Given this largely mirrors core’s sortable header behavior, keeping it as-is with an ignore is reasonable; if you ever customize it further, you might extract the sort-state calculation into a helper to relieve complexity instead of expanding the ignore.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
phpcs.xmlis excluded by!**/*.xml
📒 Files selected for processing (4)
classes/controllers/FrmFormsController.phpclasses/helpers/FrmFormsHelper.phpclasses/helpers/FrmListHelper.phpclasses/helpers/FrmXMLHelper.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: PHP 8 tests in WP 6.9
- GitHub Check: PHP 7.4 tests in WP 6.9
- GitHub Check: Cypress
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP 6.9
- GitHub Check: PHP 7.4 tests in WP 6.9
…_for_cyclomatic_complexity Add php codesniffer baseline for cyclomatic complexity
No description provided.