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 GCI106 was created.
Added a corresponding Python unit test.
Updated the CHANGELOG accordingly.

cleophass and others added 3 commits May 19, 2025 16:37
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 4, 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 4, 2025
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
@github-actions github-actions bot removed the stale label Jul 22, 2025
dedece35
dedece35 previously approved these changes Jul 23, 2025
@dedece35 dedece35 requested a review from Copilot July 23, 2025 21:05

This comment was marked as outdated.

@dedece35
Copy link
Member

please check feedbacks of Copilot above.

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 adds a new rule GCI106 "AvoidSqrtInLoop" to detect and flag uses of scalar square root functions (math.sqrt and numpy.sqrt) within loops. The rule promotes using vectorized operations on arrays instead of scalar operations in loops for better performance and energy efficiency.

  • Implementation of the AvoidSqrtInLoop check that detects sqrt calls within for/while loops
  • Addition of comprehensive test cases covering various compliant and non-compliant scenarios
  • Integration of the new rule into the plugin configuration and test suite

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/org/greencodeinitiative/creedengo/python/checks/AvoidSqrtInLoop.java Main implementation of the GCI106 rule that detects sqrt calls in loops
src/test/java/org/greencodeinitiative/creedengo/python/checks/AvoidSqrtInLoopTest.java Unit test for the new rule
src/test/resources/checks/avoidSqrtInLoop.py Test cases with compliant and non-compliant code examples
src/main/java/org/greencodeinitiative/creedengo/python/PythonRuleRepository.java Registration of the new rule in the repository
src/main/resources/org/greencodeinitiative/creedengo/python/creedengo_way_profile.json Addition of GCI106 to the profile
src/it/test-projects/creedengo-python-plugin-test-project/src/avoidSqrtInLoop.py Integration test file
src/it/java/org/greencodeinitiative/creedengo/python/integration/tests/GCIRulesIT.java Integration test for the new rule
pom.xml Version bump for creedengo-rules-specifications
CHANGELOG.md Documentation of the new rule addition

@dedece35 dedece35 merged commit 062eee2 into green-code-initiative:main Jul 24, 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