Closed MartinThoma closed 2 years ago
Going in a similar direction, in the following example the rule should also not be triggered:
for symbol_pred in pred_seg:
for symbol_real in real_seg:
if symbol_pred[0] in symbol_real:
for stroke in symbol_pred:
if stroke not in symbol_real:
return True
return False
Checking for the exception case is actually not that easy. Doing it requires not only to get the parent node of the first for-loop, but to get the next sibling of that for-loop. There could be multiple for-loops within the parent.
Add a test:
def test_sim110_other_false_positive():
ret = _results(
"""for symbol_pred in pred_seg:
for symbol_real in real_seg:
if symbol_pred[0] in symbol_real:
for stroke in symbol_pred:
if stroke not in symbol_real:
return True
return False"""
)
for el in ret:
assert "SIM110" not in el
Desired change
Example
This is an example where the mentioned rule(s) would currently be suboptimal: