Skip to content

fix: prefer optional chaining over logical AND guard (S6582)#3629

Merged
arkid15r merged 2 commits intoOWASP:mainfrom
anukalp2804:fix/sonar-s6582-optional-chaining-issues-list
Jan 29, 2026
Merged

fix: prefer optional chaining over logical AND guard (S6582)#3629
arkid15r merged 2 commits intoOWASP:mainfrom
anukalp2804:fix/sonar-s6582-optional-chaining-issues-list

Conversation

@anukalp2804
Copy link
Contributor

Proposed change

Resolves #3500

This PR addresses SonarCloud rule typescript:S6582 by replacing a logical AND guard with optional chaining when rendering the issues list.

The change improves readability and maintainability while preserving existing behavior.

Checklist

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Summary by CodeRabbit

Release Notes

This release contains internal code quality improvements with no user-facing changes.

  • Refactor
    • Improved code maintainability in the contributions section.

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

Walkthrough

Single-file refactor in the contribute page that replaces an explicit logical AND guard with optional chaining when rendering the issues list, aligning with SonarCloud rule S6582. No functional logic changes.

Changes

Cohort / File(s) Summary
Optional chaining refactor
frontend/src/app/contribute/page.tsx
Replaced {issues && issues.map(renderContributeCard)} with {issues?.map(renderContributeCard)} for conditional rendering

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested labels

frontend

Suggested reviewers

  • arkid15r
  • kasya
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing a logical AND guard with optional chaining to address SonarCloud rule S6582.
Description check ✅ Passed The description is clearly related to the changeset, explaining the fix for SonarCloud rule S6582 and the specific change made to the issues list rendering.
Linked Issues check ✅ Passed The PR successfully addresses issue #3500 by replacing the logical AND guard with optional chaining, exactly as required to satisfy the typescript:S6582 rule.
Out of Scope Changes check ✅ Passed The PR contains only the required change: replacing logical AND with optional chaining in the issues list rendering, with no out-of-scope modifications.
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.

@anukalp2804
Copy link
Contributor Author

Hi @arkid15r , @kasya
This PR addresses the assigned SonarCloud S6582 issue. Please let me know if any changes are needed.

@arkid15r arkid15r enabled auto-merge January 29, 2026 00:37
@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.55%. Comparing base (a5484f9) to head (00213df).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3629      +/-   ##
==========================================
- Coverage   85.55%   85.55%   -0.01%     
==========================================
  Files         463      463              
  Lines       14303    14302       -1     
  Branches     1904     1903       -1     
==========================================
- Hits        12237    12236       -1     
  Misses       1687     1687              
  Partials      379      379              
Flag Coverage Δ
backend 84.53% <ø> (ø)
frontend 88.38% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
frontend/src/app/contribute/page.tsx 94.73% <ø> (-0.27%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5484f9...00213df. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Fix Sonar S6582: Prefer optional chaining when rendering issues list

2 participants