Skip to content
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

[EC69] - check relevance of this rule #16

Closed
dedece35 opened this issue Mar 22, 2024 · 1 comment
Closed

[EC69] - check relevance of this rule #16

dedece35 opened this issue Mar 22, 2024 · 1 comment
Assignees
Labels
🗃️ rule rule improvment or rule development or bug

Comments

@dedece35
Copy link
Member

like in python issue green-code-initiative/creedengo-python#21, check if implemented EC69 rule in C# plugin is relevant or not

@dedece35 dedece35 added the 🗃️ rule rule improvment or rule development or bug label Mar 22, 2024
@dedece35 dedece35 changed the title check relevance of EC69 [EC69] - check relevance of this rule Mar 22, 2024
@vdebellabre
Copy link
Collaborator

vdebellabre commented Mar 23, 2024

For loops in Python match foreach loops in C#, and don't trigger a warning with our rule implementation.

foreach (int i in Enumerable.Range(0, 10)) // Compliant, evaluated once

For loops however are equivalent to for loops in C/C++, and evaluate function calls in conditions at every iteration, this is what our rule covers.

for (int i = 0; i < GetValue(); i++) // Non compliant, loop invariant function in loop condition

This is also the case for while and do-while loops, our rule implementation covers those too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗃️ rule rule improvment or rule development or bug
Projects
None yet
Development

No branches or pull requests

2 participants