Skip to content

GCI82 [Team STEP][2025] correct false positives#110

Merged
dedece35 merged 6 commits intogreen-code-initiative:mainfrom
max-208:82-java
Jul 8, 2025
Merged

GCI82 [Team STEP][2025] correct false positives#110
dedece35 merged 6 commits intogreen-code-initiative:mainfrom
max-208:82-java

Conversation

@max-208
Copy link
Copy Markdown
Contributor

@max-208 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 jbureau92 self-assigned this May 21, 2025
@jbureau92 jbureau92 added the 👀 👀 review done 👀 👀 review done - waiting for changes label May 21, 2025
@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has no activity for 30 days.
Please add a comment if you want to keep the issue open. Thank you for your contributions!

@github-actions github-actions bot added the stale label Jun 21, 2025
@github-actions github-actions bot removed the stale label Jul 5, 2025
Copy link
Copy Markdown

Copilot AI left a comment

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 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_idx uses an underscore and does not follow Java's camelCase convention. Consider renaming to argumentIndex for consistency with project style.
            int argument_idx = arguments.indexOf(tree);

@dedece35 dedece35 merged commit 1dead4d into green-code-initiative:main Jul 8, 2025
1 check passed
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.

4 participants