refactor: remove unnecessary and redundant declarations, that don't m… #300
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.
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:
(collision/TimeOfImpact.ts)
The local variable
s
added no meaningful context to the function’s behavior. By directly returning the result ofmatrix.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.