You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor: move date picker style helpers to module scope - #131
Move clearStyles and setStyleForDay out of _updateMonthStyles to module scope in fc-date-picker.js, as reported by Sonar (javascript:S7721). They now receive the calendar as a parameter instead of being invoked with .call.
No actionable comments were generated in the recent review.
Walkthrough
The date picker moves style-clearing and day-style callbacks to module-level helpers. _updateMonthStyles calls the helpers with the calendar element. Its style-fetching and month-check conditions remain unchanged.
Changes
Date picker style updates
Layer / File(s)
Summary
Extract and use style helpers src/main/resources/META-INF/frontend/fc-date-picker/fc-date-picker.js
Style-clearing and day-style callbacks are module-level helpers that receive the calendar element. _updateMonthStyles uses these helpers and retains its existing style-fetching and month-check conditions.
This is a behavior-preserving refactor of date picker style helpers that satisfies the Sonar rule. No user-facing change or merge risk is identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title states a refactor that moves the date picker style helpers (clearStyles and setStyleForDay) to module scope. The raw summary confirms that _updateMonthStyles now calls these module-level hel…
Linked Issues check
Issue #102 asks that the date-picker helpers in fc-date-picker.js move to the outer scope, so Sonar rule javascript:S7721 no longer flags them. The diff moves both helpers to module scope: `clearStyle…
Out of Scope Changes check
Every changed hunk in fc-date-picker.js supports the S7721 refactor. The two helpers move to module scope. The .call invocations become direct calls with the calendar argument. The local const dec…
Full details: Title check
Explanation
The title states a refactor that moves the date picker style helpers (clearStyles and setStyleForDay) to module scope. The raw summary confirms that _updateMonthStyles now calls these module-level helpers with the calendar element instead of using local callbacks invoked with this bound to the element. The PR objectives match this change, which addresses Sonar rule javascript:S7721 for issue #102. The title is specific, concise, and describes the main change.
Full details: Linked Issues check
Explanation
Issue #102 asks that the date-picker helpers in fc-date-picker.js move to the outer scope, so Sonar rule javascript:S7721 no longer flags them. The diff moves both helpers to module scope: clearStyles(calendar) and setStyleForDay(calendar, i, className) are now top-level functions. Each one takes the calendar as a parameter and reads calendar.shadowRoot, so they no longer depend on this. _updateMonthStyles calls them directly (clearStyles(element), setStyleForDay(element, i, styles[i])) instead of using .call. The selectors, class handling, and the fetch and apply conditions are unchanged. The issue names the helpers _clearStyles and _setStyleForDay. The PR drops the leading underscore. This naming difference does not affect the Sonar objective or behavior. No automated test is part of the coding requirement, and the issue asks for none.
Full details: Out of Scope Changes check
Explanation
Every changed hunk in fc-date-picker.js supports the S7721 refactor. The two helpers move to module scope. The .call invocations become direct calls with the calendar argument. The local const declarations of the helpers are removed. One unrelated-looking change is the let to const conversion inside the helper bodies. It is part of the same moved code and does not change behavior. No other files or unrelated logic changed. The diff reports +17/-17 lines.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move
clearStylesandsetStyleForDayout of_updateMonthStylesto module scope in fc-date-picker.js, as reported by Sonar (javascript:S7721). They now receive the calendar as a parameter instead of being invoked with.call.Close #102
Summary by CodeRabbit