603 if isinstance(stmt, ast.Return): |
603 if isinstance(stmt, ast.Return): |
604 finallyHasReturn = True |
604 finallyHasReturn = True |
605 finallyReturn = stmt |
605 finallyReturn = stmt |
606 break |
606 break |
607 |
607 |
608 if (tryHasReturn or exceptHasReturn) and finallyHasReturn: |
608 if ( |
609 if finallyReturn is not None: |
609 (tryHasReturn or exceptHasReturn) and |
610 self.__error(finallyReturn.lineno - 1, |
610 finallyHasReturn and |
611 finallyReturn.col_offset, "Y107") |
611 finallyReturn is not None |
|
612 ): |
|
613 self.__error(finallyReturn.lineno - 1, |
|
614 finallyReturn.col_offset, "Y107") |
612 |
615 |
613 def __check108(self, node): |
616 def __check108(self, node): |
614 """ |
617 """ |
615 Private method to check for if-elses which could be a ternary |
618 Private method to check for if-elses which could be a ternary |
616 operator assignment. |
619 operator assignment. |
1577 isinstance(node.func, ast.Name) and |
1580 isinstance(node.func, ast.Name) and |
1578 node.func.id == "range" |
1581 node.func.id == "range" |
1579 ) |
1582 ) |
1580 isException = isException or ( |
1583 isException = isException or ( |
1581 isinstance(node.func, ast.Attribute) and |
1584 isinstance(node.func, ast.Attribute) and |
1582 node.func.attr in ["get", "insert",] |
1585 node.func.attr in ("get", "insert") |
1583 ) |
1586 ) |
1584 |
1587 |
1585 if hasBareNumeric and not isException: |
1588 if hasBareNumeric and not isException: |
1586 self.__error(node.lineno - 1, node.col_offset, "Y402") |
1589 self.__error(node.lineno - 1, node.col_offset, "Y402") |
1587 |
1590 |