SONARPY-471 Rule S2190: Recursion should not be infinite#461
Conversation
b974811 to
f2cdd92
Compare
f2cdd92 to
b6b71fe
Compare
There was a problem hiding this comment.
Could you please add a test case in CheckUtilsTest for this?
There was a problem hiding this comment.
Nitpicking: could you please add newline here?
There was a problem hiding this comment.
I think we could add a test case to document the following FN:
def f(p):
return f(p) if p else f(p) # FNThere was a problem hiding this comment.
I think we could add a test case to document the following FN:
def fn():
if fn() or x == 10:
...There was a problem hiding this comment.
Nop, there's no FN, visitBinaryExpression always takes into account leftOperand() recursion, even for or and and.
I added the following test:
def fun21(x): # Noncompliant
if fun21(x + 1) or x == 10:
print(2)
There was a problem hiding this comment.
It's not very clear to me why we're excluding for statements. Is it for a limitation in the CFG? In that case, please create a ticket for it and document in the unit tests
There was a problem hiding this comment.
Now, I think it's useless. It was probably useful before I exclude lambda or sub-function, but it was not the right workaround. So I removed this visitForStatement and added more test related to for.
b6b71fe to
ed83d94
Compare
…go.db.models.Model`. (#461) GitOrigin-RevId: 41e302fa7fcd41f7268a82e31f60e38ddd97504e
No description provided.