Skip to content

fix: justify empty ResizeObserver mock methods (S1186)#3403

Merged
arkid15r merged 3 commits intoOWASP:mainfrom
anukalp2804:fix/sonar-s1186-resizeobserver-mock
Jan 18, 2026
Merged

fix: justify empty ResizeObserver mock methods (S1186)#3403
arkid15r merged 3 commits intoOWASP:mainfrom
anukalp2804:fix/sonar-s1186-resizeobserver-mock

Conversation

@anukalp2804
Copy link
Contributor

Proposed change

Resolves #3337

This PR resolves SonarCloud rule typescript:S1186 by documenting intentionally empty methods in the ResizeObserver mock implementation.

The following mock methods were previously empty and triggered maintainability warnings:

  • disconnect()
  • observe()
  • unobserve()

Clear comments were added to explicitly state that these methods are intentionally empty as part of a mock implementation. No functional behavior has been changed.

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran the relevant local checks (lint) and all warnings were addressed
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Summary by CodeRabbit

  • Chores
    • Updated test setup configuration with code quality annotations.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Adds explanatory NOSONAR/justification comments to the empty disconnect, observe, and unobserve methods of the ResizeObserver mock in the Jest setup; no runtime behavior or exported declarations changed.

Changes

Cohort / File(s) Summary
ResizeObserver mock comments
frontend/jest.setup.ts
Inserted inline comments (NOSONAR / justification) inside empty disconnect(), observe(), and unobserve() method bodies to document intentional empty mock implementations. No code logic changed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • kasya
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding justification comments to empty ResizeObserver mock methods to resolve SonarCloud rule S1186.
Description check ✅ Passed The description is directly related to the changeset, explaining the SonarCloud S1186 rule violation, the specific methods addressed, and the solution of adding comments to justify empty methods.
Linked Issues check ✅ Passed The PR directly addresses linked issue #3337 by adding NOSONAR comments to the three empty methods (disconnect, observe, unobserve) in ResizeObserver mock, fully resolving the stated coding requirements.
Out of Scope Changes check ✅ Passed All changes are scoped to the ResizeObserver mock methods in frontend/jest.setup.ts; no additional unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 18, 2026
@anukalp2804
Copy link
Contributor Author

@arkid15r
This PR addresses the assigned SonarCloud S1186 issue. Please let me know if any changes are needed. Thanks

@sonarqubecloud
Copy link

@arkid15r arkid15r enabled auto-merge January 18, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sonar S1186: Empty ResizeObserver methods should be justified or implemented

2 participants

Comments