GCI82 [Team STEP][2025] correct false positives#110
Merged
dedece35 merged 6 commits intogreen-code-initiative:mainfrom Jul 8, 2025
Merged
GCI82 [Team STEP][2025] correct false positives#110dedece35 merged 6 commits intogreen-code-initiative:mainfrom
dedece35 merged 6 commits intogreen-code-initiative:mainfrom
Conversation
Contributor
max-208
commented
May 21, 2025
- remove false positives with reasignement using this.var
- remove false positives with passing of a variable to a function it can be reassinged in
- remove false positives with reasignement using this.var - remove false positives with passing of a variable to a function it can be reassinged in
jbureau92
reviewed
May 21, 2025
.../java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java
Outdated
Show resolved
Hide resolved
.../java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java
Show resolved
Hide resolved
.../java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java
Show resolved
Hide resolved
.../java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java
Outdated
Show resolved
Hide resolved
.../java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java
Outdated
Show resolved
Hide resolved
|
This PR has been automatically marked as stale because it has no activity for 30 days. |
dedece35
requested changes
Jul 5, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR refines rule GCI82 to eliminate false positives for variables reassigned via this. or passed as non-final parameters, updates corresponding tests, and documents the change.
- Extend rule logic to detect and skip variables passed to methods or constructors as non-final parameters
- Add new test cases covering
this.assignments and parameter-passing scenarios - Update integration test expected lines and record changes in CHANGELOG
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/files/MakeNonReassignedVariablesConstants.java | Added compliant/noncompliant cases for this. reassignment and parameter passing |
| src/main/java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java | Introduced isPassedAsNonFinalParameter and updated isNotReassigned logic and debug logs |
| src/it/test-projects/.../MakeNonReassignedVariablesConstants.java | Mirrored new test cases in the integration test project |
| src/it/java/org/greencodeinitiative/creedengo/java/integration/tests/GCIRulesIT.java | Updated expected issue line numbers to include new test cases |
| CHANGELOG.md | Documented false-positive fixes for rule GCI82 |
Comments suppressed due to low confidence (1)
src/main/java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java:70
- [nitpick] The variable name
argument_idxuses an underscore and does not follow Java's camelCase convention. Consider renaming toargumentIndexfor consistency with project style.
int argument_idx = arguments.indexOf(tree);
.../java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java
Outdated
Show resolved
Hide resolved
dedece35
approved these changes
Jul 8, 2025
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.