issue 5929 alternative fix#2482
Conversation
|
Warning Rate limit exceeded@Crabcyborg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 38 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughRefactored FrmStylesHelper::output_vars to delegate CSS variable emission decisions to a new private helper should_add_css_var which prepares and validates values, compares against defaults, and provides a prepared value; output_vars now echoes the CSS var only when the helper permits. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant StylesHelper as FrmStylesHelper
participant Preparer as css_var_prepare_value
participant Validator as css_value_is_valid
Caller->>StylesHelper: output_vars(settings, defaults)
loop each CSS variable
StylesHelper->>Preparer: css_var_prepare_value(settings, var)
Preparer-->>StylesHelper: prepared_value
alt prepared_value empty
StylesHelper-->>StylesHelper: skip output
else if prepared_value == default
StylesHelper-->>StylesHelper: skip output
else
StylesHelper->>Validator: css_value_is_valid(prepared_value)
alt valid
StylesHelper-->>Caller: echo "--var: prepared_value"
else
StylesHelper-->>StylesHelper: skip output
end
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
classes/helpers/FrmStylesHelper.php (1)
454-462: Docblock: clarify purpose, by-ref param, and finalize @SInCE before mergeAdd a short summary, mark the by-reference param, and replace x.x with the release version.
Apply this diff:
- /** - * @since x.x - * - * @param array $settings - * @param array $defaults - * @param string $var - * @param string $prepared_value - * @return bool - */ + /** + * Decide if a CSS custom property should be output and return the prepared value by reference. + * + * @since x.x + * + * @param array $settings Settings array for the current style. + * @param array $defaults Default settings array for comparison. + * @param string $var The settings key / CSS variable name. + * @param string &$prepared_value Prepared CSS value (output parameter). + * @return bool True to output, false to skip. + */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
classes/helpers/FrmStylesHelper.php(1 hunks)
⏰ 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). (7)
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Run PHP Syntax inspection (8.3)
- GitHub Check: Cypress
🔇 Additional comments (1)
classes/helpers/FrmStylesHelper.php (1)
448-450: LGTM: cleaner call site and single source of truth for value prepThe refactor reduces duplication and centralizes validation. Echoing the prepped value only when permitted is correct.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2482 +/- ##
============================================
- Coverage 27.48% 27.35% -0.13%
- Complexity 8706 8710 +4
============================================
Files 140 140
Lines 28739 28750 +11
============================================
- Hits 7898 7864 -34
- Misses 20841 20886 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Liviu-p
left a comment
There was a problem hiding this comment.
Looks good to me @Crabcyborg, I can confirm that it fixes the issue reported by Emma as well.
|
Thanks Liviu! |
Related PR #2456
Fixes https://github.com/Strategy11/formidable-pro/issues/5929
I don't love the list of hard coded keys. I think we really just want to check the prepared values instead of the other value.
I tried this out on Emma's QA site and it looks like it works well.