Skip to content

Development of rules GCI300, GCI301, GCI302, GCI303, GCI304, GCI305, GCI306, GCI307, GCI308, GCI309, GCI310, GCI311, GCI312 #66

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

Closed
wants to merge 0 commits into from

Conversation

cleophass
Copy link

Co-authored-by: DataLabGroupe-CreditAgricole GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR

@@ -40,7 +40,21 @@ public class PythonRuleRepository implements RulesDefinition, PythonCustomRuleRe
AvoidFullSQLRequest.class,
Copy link
Member

Choose a reason for hiding this comment

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

Some global feedbacks :

  • regarding rule number ... we must follow next number i.e. GCI95 until GCI202
  • before implementing rules,
    • we must have specifications ready in "creedengo-rules-specifications" repository because of use of this component as dependency
    • we must check if each rule should be implemented or not (external argumentation, research paper, ...)
  • this PR is too big ... we must use small PR to be more efficient and to deliver more rules
  • I think ofr each rule, we should associate the implementation to rule idea created in previous hackathons in creedengo-challenge and creedengo-common repositories (issues tab)
  • do you check if there is an existing rule but not yet implemented (in "RULES.md" file in "creedengo-rules-specicifatcions" repository) ?
  • the "definition of done" process isn't followed ... please check it : https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md#check-definition-of-done-for-new-rule-implementation

}

private void report(StringElement stringElement, SubscriptionContext ctx) {
private void repport(StringElement stringElement, SubscriptionContext ctx) {
Copy link
Member

Choose a reason for hiding this comment

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

i don't understand this modification ... I think "report" is the good name ... because the best practice for a name method is to use a verb and not an noun. a best method name should be "raiseIssue"

@@ -0,0 +1,101 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

this kind of Utils class should be in a different package ... the "checks" package is done for implementation rule classes.
I think, we can use "org.greencodeinitiative.creedengo.python" for example

@@ -24,7 +24,6 @@ public class AvoidSQLRequestInLoopTest {
@Test
public void test() {
PythonCheckVerifier.verify("src/test/resources/checks/avoidSQLRequestInLoop.py", new AvoidSQLRequestInLoop());
PythonCheckVerifier.verify("src/test/resources/checks/avoidSQLRequestInLoopCheck.py", new AvoidSQLRequestInLoop());
Copy link
Member

Choose a reason for hiding this comment

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

why do you delete this use case ?
maybe rename the test file ... but this is a real use case

@@ -1,24 +1,70 @@
from datetime import date
# -*- coding: utf-8 -*-
Copy link
Member

Choose a reason for hiding this comment

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

why do you change a lot this test file ? I think your test file is a new use case and the old one is another real use case (even if is not the best practice of Python development)

@@ -25,7 +25,7 @@ def testWithForLoop(self):
cursor = db.cursor(dictionary=True)

for i in range(0, self.maxrows):
cursor.execute("SELECT id, name FROM users WHERE id = %(id)s", {'id': i+1}) # Noncompliant {{Avoid performing SQL queries within a loop}}
cursor.execute("SELECT id, name FROM users WHERE id = %(id)s", {'id': i+1}) #Noncompliant
Copy link
Member

Choose a reason for hiding this comment

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

why do you delete the error message ? It is mandatory for me ...

@cleophass cleophass marked this pull request as draft May 14, 2025 09:48
@cleophass cleophass closed this May 14, 2025
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