Skip to content

Add php codesniffer baseline for cyclomatic complexity#2747

Merged
Crabcyborg merged 1 commit into
masterfrom
add_php_codesniffer_baseline_for_cyclomatic_complexity
Jan 8, 2026
Merged

Add php codesniffer baseline for cyclomatic complexity#2747
Crabcyborg merged 1 commit into
masterfrom
add_php_codesniffer_baseline_for_cyclomatic_complexity

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

No description provided.

@Crabcyborg Crabcyborg added this to the 6.27 milestone Jan 8, 2026
@Crabcyborg Crabcyborg merged commit a2466fd into master Jan 8, 2026
35 of 36 checks passed
@Crabcyborg Crabcyborg deleted the add_php_codesniffer_baseline_for_cyclomatic_complexity branch January 8, 2026 21:42
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 8, 2026

Walkthrough

This 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

Cohort / File(s) Summary
PHPCS Lint Suppression Comments
classes/controllers/FrmFormsController.php, classes/helpers/FrmFormsHelper.php, classes/helpers/FrmListHelper.php, classes/helpers/FrmXMLHelper.php
Added phpcs:ignore annotations to suppress Generic.Metrics.CyclomaticComplexity.MaxExceeded warnings on the route(), form_switcher(), print_column_headers(), and populate_postmeta() methods respectively. No behavioral changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a brief description explaining the purpose of adding phpcs baseline annotations for cyclomatic complexity violations.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding phpcs ignore annotations for cyclomatic complexity violations across multiple helper/controller classes.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
classes/helpers/FrmXMLHelper.php (1)

1294-1377: Cyclomatic-complexity ignore is safe and keeps tooling noise down

The added Generic.Metrics.CyclomaticComplexity.MaxExceeded suppression on populate_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 large frm_options branch 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 decomposition

Extending the existing PHPCS ignore on route() to cover Generic.Metrics.CyclomaticComplexity.MaxExceeded is 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 PR

Adding the extra PHPCS ignore for Generic.Metrics.CyclomaticComplexity.MaxExceeded is 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 / $args resolution 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 acceptable

The added Generic.Metrics.CyclomaticComplexity.MaxExceeded suppression on print_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

📥 Commits

Reviewing files that changed from the base of the PR and between a448241 and 585c956.

⛔ Files ignored due to path filters (1)
  • phpcs.xml is excluded by !**/*.xml
📒 Files selected for processing (4)
  • classes/controllers/FrmFormsController.php
  • classes/helpers/FrmFormsHelper.php
  • classes/helpers/FrmListHelper.php
  • classes/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

stephywells pushed a commit that referenced this pull request Apr 4, 2026
…_for_cyclomatic_complexity

Add php codesniffer baseline for cyclomatic complexity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant