Skip to content

Fix for Useless conditional - #210

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

PDowney merged 1 commit into
masterfrom
finding-autofix-ebfc670e

Conversation

@PDowney

@PDowney PDowney commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

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

Thanks for contributing to EngineScript! 🎉

If your PR fixes an issue or relates to a specific environment, please consider including the sanitized output
of es.debug to show the environment where you tested your changes.
Remember to remove any sensitive information before sharing.

We'll review your PR soon!

@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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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