Deprecate unused function frmFrontForm.escapeHtml#2178
Conversation
WalkthroughThe pull request introduces significant changes to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
js/formidable.js (1)
1945-1945: Update deprecation message with the correct version numberThe
console.warnstatement in theescapeHtmlfunction uses a placeholder'vx.x'for the version number. Please update it to the actual version (e.g.,'v6.16.3') for consistency and clarity in deprecation notices.Apply this diff to correct the version number:
- console.warn( 'DEPRECATED: function frmFrontForm.escapeHtml in vx.x' ); + console.warn( 'DEPRECATED: function frmFrontForm.escapeHtml in v6.16.3' );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
js/formidable.js(1 hunks)
🔇 Additional comments (4)
js/formidable.js (4)
Line range hint 1960-1963: Consider removing the deprecated invisible function if it's no longer used
The invisible function has been marked as deprecated and logs a warning. If it's obsolete and no longer used, consider removing it to clean up the codebase. If it needs to stay for compatibility, ensure the deprecation is well-documented.
Run the following script to check for any remaining usages of invisible:
Line range hint 807-839: Verify that all calls to validateFieldValue pass the new onSubmit parameter
The validateFieldValue function has been updated to include the new onSubmit parameter. Ensure that all function calls to validateFieldValue are updated accordingly to prevent unexpected behavior during form validation.
Run the following script to identify any calls to validateFieldValue that may not have been updated:
Line range hint 1944-1952: Consider removing the deprecated escapeHtml function if it's no longer used
The escapeHtml function has been marked as deprecated and logs a warning. If this function is no longer used in the codebase, consider removing it to simplify the code. If it must remain for backward compatibility, ensure its deprecation is properly documented and plan for its removal in future versions.
Run the following script to check for any remaining usages of escapeHtml:
✅ Verification successful
Remove the deprecated and unused escapeHtml function
Based on the comprehensive search results, the escapeHtml function appears to be defined in js/formidable.js but has no active usage in the codebase. The function is already marked as deprecated with a console warning, and our thorough search using various patterns couldn't find any calls to this function. It's safe to remove this unused code.
- Remove the
escapeHtmlfunction fromjs/formidable.js(lines 1941-1947)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find usages of the deprecated 'escapeHtml' function.
# Expect: No matches if the function is no longer used.
rg 'escapeHtml\('
Length of output: 19
Script:
#!/bin/bash
# Let's try a more comprehensive search for escapeHtml usage
# 1. Search for the function name without parentheses
# 2. Search for the function name as a property/method
# 3. Include some context lines for better understanding
rg -i "escapehtml" -A 2
# Also search in the AST for function calls
ast-grep --pattern 'escapeHtml($_)'
# And search for the function definition to understand its context better
ast-grep --pattern 'escapeHtml: function($_) { $$$ }'
Length of output: 7333
Script:
#!/bin/bash
# Let's search for any actual calls to escapeHtml in the codebase
# Using different variations to ensure we catch all uses
# Search for direct function calls
rg -i "\.escapeHtml\(" -A 2
# Search for variable assignments or references
rg -i "= escapeHtml" -A 2
# Search for the function name in object destructuring
rg -i "\{.*escapeHtml.*\}" -A 2
Length of output: 91
Line range hint 1970-1973: Consider removing the deprecated visible function if it's no longer used
The visible function has been marked as deprecated and logs a warning. If it's no longer necessary, consider removing it to reduce code clutter. If retaining it for compatibility, ensure its deprecation status is clearly documented.
Run the following script to check for any remaining usages of visible:
I found this being used in old v2.0 code. But it hasn't been used since v3.0+.