-
Notifications
You must be signed in to change notification settings - Fork 22
GCI106 AvoidSqrtInLoop #Python #DLG #Build #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
|
This PR has been automatically marked as stale because it has no activity for 30 days. |
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
|
please check feedbacks of Copilot above. |
There was a problem hiding this 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 |
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.