if
statements can be merged PTC-W0048414 else:
415 et.SubElement(rule, 'severity').text = 'INFO'
416
417 if 'type' in data:418 if data['type'] != 'CODE_SMELL': # CODE_SMELL is the default
419 et.SubElement(rule, 'type').text = data['type']
420
Nested if
statements can be collapsed into a single if
statement by separating their condition using and
operator.
Merging collapsible if
statements increases the code's readability.
if condition1:
if condition2:
dosomething()
if condition1 and condition2:
dosomething()
DeepSource will not raise this issue when the nested if
statements have comments in between them, as it could be explaining why the nested if
is in place.