Fix for Useless conditional by PDowney · Pull Request #211 · EngineScript/EngineScript · GitHub
Skip to content

Fix for Useless conditional#211

Merged
PDowney merged 1 commit intomasterfrom
finding-autofix-dfbf32e8
Apr 20, 2026
Merged

Fix for Useless conditional#211
PDowney merged 1 commit intomasterfrom
finding-autofix-dfbf32e8

Conversation

@PDowney
Copy link
Copy Markdown
Collaborator

@PDowney PDowney commented Apr 20, 2026

To fix this, remove the redundant if (storage) guards in the two inner cleanup blocks and call storage.removeItem('servicePreferences') directly.
This preserves functionality because execution can only reach those blocks after the earlier if (!storage) return null; guard.

Where to change:

  • File: config/var/www/admin/control-panel/external-services/external-services.js
  • Region: loadServicePreferences() around lines 1488–1511.
  • No new imports, methods, or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@sonarqubecloud
Copy link
Copy Markdown

@PDowney PDowney marked this pull request as ready for review April 20, 2026 23:21
Copilot AI review requested due to automatic review settings April 20, 2026 23:21
@PDowney PDowney merged commit 4da5821 into master Apr 20, 2026
14 of 15 checks passed
@github-actions github-actions Bot deleted the finding-autofix-dfbf32e8 branch April 20, 2026 23:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes redundant if (storage) guards in loadServicePreferences() when clearing invalid/oversized stored preferences, relying on the existing early-return when localStorage is unavailable.

Changes:

  • Removed unnecessary if (storage) checks before calling storage.removeItem('servicePreferences') in two cleanup paths.
  • Kept existing error handling via try/catch around removeItem calls.

Comment on lines 1486 to 1490
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Project convention requires updating the root CHANGELOG.md whenever the codebase is modified; please add an entry describing this service-preferences cleanup (see .github/copilot-instructions.md:48-53).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants