Skip to content

Conversation

@cleophass
Copy link
Contributor

Verified that the rule does not exist.
Confirmed that the rule is not listed in Rules.MD, so a new ID GCI99 was created.
Added a corresponding Python unit test.
Updated the CHANGELOG accordingly.

cleophass and others added 3 commits May 19, 2025 16:06
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
@github-actions
Copy link

github-actions bot commented Jul 3, 2025

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 Jul 3, 2025
…ations version and rename rule GCI99 to GCI97

Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
@github-actions github-actions bot removed the stale label Jul 11, 2025
@dedece35 dedece35 requested review from Copilot and dedece35 July 12, 2025 20:52
Copy link
Contributor

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 introduces a new Python rule (GCI99) to detect and flag inefficient square computations (x**2 and math.pow(x, 2)) and suggests using x*x instead. Key changes include:

  • Implementation of the OptimizeSquareComputation rule in Java.
  • Addition of Python test cases and a JUnit test.
  • Registration of the new rule, bumping of the spec version, and changelog update.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/test/resources/checks/optimizeSquareComputation.py Adds sample Python cases marked noncompliant for square ops.
src/test/java/org/greencodeinitiative/creedengo/python/checks/OptimizeSquareComputationTest.java Adds a JUnit test invoking the new rule.
src/main/java/org/greencodeinitiative/creedengo/python/checks/OptimizeSquareComputation.java Implements the logic to flag **2 and math.pow(..., 2).
src/main/java/org/greencodeinitiative/creedengo/python/PythonRuleRepository.java Registers the new rule in the repository.
pom.xml Bumps creedengo-rules-specifications to 2.3.0.
CHANGELOG.md Documents addition of rule GCI99.

Copy link
Member

@dedece35 dedece35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an integration test like explained in another PR : #71 (review)

cleophass and others added 2 commits July 16, 2025 15:08
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
@dedece35 dedece35 merged commit 589a877 into green-code-initiative:main Jul 18, 2025
1 check failed
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.

2 participants