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

Fix for Useless conditional#210

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

Fix for Useless conditional#210
PDowney merged 1 commit intomasterfrom
finding-autofix-ebfc670e

Conversation

@PDowney
Copy link
Copy Markdown
Collaborator

@PDowney PDowney commented Apr 20, 2026

To fix this without changing behavior, remove the redundant truthiness check around storage.removeItem('servicePreferences') in the parse-error cleanup block. At that point in control flow, storage is already guaranteed to exist (otherwise the function would have returned earlier), so directly calling storage.removeItem(...) inside the existing try/catch preserves error handling while eliminating the always-true condition.

Change region: config/var/www/admin/control-panel/external-services/external-services.js, around lines 1507–1510 in loadServicePreferences().

No new imports, methods, or dependencies are needed.

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 b19db9f into master Apr 20, 2026
13 of 14 checks passed
@github-actions github-actions Bot deleted the finding-autofix-ebfc670e 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 an always-true conditional check around storage.removeItem('servicePreferences') in the parse-error cleanup path of loadServicePreferences(), relying on the earlier guard that already returns when localStorage is unavailable.

Changes:

  • Simplifies the parse-error cleanup block by directly calling storage.removeItem('servicePreferences') inside the existing try/catch.

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