Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unnecessary and redundant declarations, that don't m… #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diogomene
Copy link

What was done?

Unnecessary local variables were removed from the codebase to improve readability and maintainability. The removed variables did not enhance the comprehensibility of the function and introduced redundant code. For instance, in the following example:

matrix.transformVec2(pointB, xfB, localPointB);

matrix.subVec2(this.m_axis, pointB, pointA);

const s = matrix.normalizeVec2Length(this.m_axis);

return s;

(collision/TimeOfImpact.ts)

The local variable s added no meaningful context to the function’s behavior. By directly returning the result of matrix.normalizeVec2Length(this.m_axis);, the code becomes cleaner and easier to follow without altering its functionality.

This may help the code remain concise and focused while adhering to best practices for code simplicity. Each change was reviewed and tested to confirm no impact on the functionality or correctness of the program.

Evidences?

The following SARIF file (generated by Qodana) contains the analysis information of the code smells analysed before the code changes.
qodana.sarif(1).json

Most of the occurrences were identified as potentially helpful syntactic sugar declarations (16 out of the 26 occurrences), ant therefore were not changed, at all.

Copy link

vercel bot commented Nov 16, 2024

@diogomene is attempting to deploy a commit to the Piqnt Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant