New sniff to improve inline comment consistency#2859
Conversation
|
Warning Rate limit exceeded
⌛ 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. 📝 WalkthroughWalkthroughThis PR standardizes comment formatting across 70+ files by capitalizing the first letter of comments and making minor wording adjustments, while introducing a new PHP_CodeSniffer sniff to enforce consistent comment spacing and capitalization rules. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes The review scope is large (70+ files) with highly homogeneous changes (comment capitalization following a consistent pattern), which reduces per-file complexity. The primary effort focuses on understanding and validating the new Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 4
🤖 Fix all issues with AI agents
In `@classes/models/FrmFieldValue.php`:
- Line 250: The comment in FrmFieldValue.php documents the WordPress filter hook
but alters its casing ("Frm_display_{fieldtype}_value_custom"), which can
mislead developers because hook names are case-sensitive; update the comment to
use the exact hook name "frm_display_{fieldtype}_value_custom" or rephrase the
sentence so the hook is shown verbatim while still allowing natural
capitalization elsewhere (locate the comment near the FrmFieldValue class
methods that reference the frm_display hook).
In `@classes/models/FrmUsage.php`:
- Around line 61-63: Update the inline comment above the $uuid assignment in
FrmUsage (the lines referencing md5( uniqid() . site_url() )) to correct the
grammar: change "an unique id" to "a unique id" so the comment reads "Close
enough to provide a unique id".
In `@phpcs-sniffs/Formidable/Sniffs/Commenting/CommentSpacingSniff.php`:
- Around line 95-97: The no-space auto-fix branch in CommentSpacingSniff.php
omits the TODO/FIXME exceptions, causing inconsistent capitalization; update the
preg_match regex used in the auto-fix path (the condition that sets $newText via
ucfirst when preg_match('/^[a-z]/', $firstChar) && ! $looksLikeCode && !
$isSingleWord && ! preg_match(...)) to include the same TODO/FIXME/other tokens
used by $shouldCapitalize so the exception list is identical to
$shouldCapitalize's regex, ensuring comments like "//todo:" are treated the same
in both branches.
In `@stripe/helpers/FrmStrpLiteLinkRedirectHelper.php`:
- Line 200: Update the capitalization of the payment method label in
FrmStrpLiteLinkRedirectHelper: find the comment/string "IDeal" (the one reading
"IDeal redirects URLs are incorrectly encoded.") and change it to the official
"iDEAL" to match the usage elsewhere (e.g., the "iDEAL" occurrence near line 98)
so the file uses a consistent brand casing throughout.
🧹 Nitpick comments (1)
classes/models/fields/FrmFieldCaptcha.php (1)
243-243: Consider rewording for grammatical completeness.The comment "The double rendering issue using the frm_turnstile_js_url hook." is a sentence fragment. Consider one of these alternatives:
- Lowercase to continue from line 242:
// the double rendering issue using the frm_turnstile_js_url hook.- Complete sentence:
// This addresses the double rendering issue when using the frm_turnstile_js_url hook.✍️ Suggested improvement
Option 1 (continuation from line 242):
-// The double rendering issue using the frm_turnstile_js_url hook. +// the double rendering issue using the frm_turnstile_js_url hook.Option 2 (complete sentence):
-// The double rendering issue using the frm_turnstile_js_url hook. +// This addresses the double rendering issue when using the frm_turnstile_js_url hook.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2859 +/- ##
=========================================
Coverage 27.04% 27.05%
- Complexity 8857 8866 +9
=========================================
Files 145 145
Lines 29812 29880 +68
=========================================
+ Hits 8063 8084 +21
- Misses 21749 21796 +47 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ments_more_consistent New sniff to improve inline comment consistency
This enforces that comments have a space (
// Commentinstead of//Comment)and start with a capital (// Commentinstead of// comment`).There are various exceptions where this isn't really helpful.
Summary by CodeRabbit
Style
Chores
✏️ Tip: You can customize this high-level summary in your review settings.