Potential fix for code scanning alert no. 56: Unused variable, import, function or class - #807
Merged
Conversation
…, function or class Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 4 |
TIP This summary will be updated as you push new changes. Give us feedback
jonobr1
marked this pull request as ready for review
April 6, 2026 18:00
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Removes an unused two variable binding in a dispose test to address a code scanning alert while preserving the side effects of creating/appending a Two instance.
Changes:
- Replaces
var two = ...with a barenew Two(...)expression in theTexture.dispose - Event Unbindingtest. - Keeps the renderer/DOM initialization behavior while eliminating the unused variable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/jonobr1/two.js/security/code-scanning/56
In general, unused variables should either be removed entirely or, if their initialization side effects are required, the initialization should be kept without binding the result to a name. Here, we want to avoid changing behavior: the construction of
new Two({...}).appendTo(document.body);should still run, but the unused bindingvar two =should be removed so there is no unused variable.The best fix is therefore to replace
var two = new Two({ ... }).appendTo(document.body);with a bare expressionnew Two({ ... }).appendTo(document.body);in theTexture.dispose - Event Unbindingtest. This keeps the renderer/DOM setup side effects but eliminates the unusedtwovariable. No new imports, methods, or definitions are required. Concretely, intests/suite/dispose.js, around line 1145–1150, update that single declaration line to removevar two =.Suggested fixes powered by Copilot Autofix. Review carefully before merging.