eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py

changeset 8251
ee6af20714c3
parent 8242
aa713ac50c0d
equal deleted inserted replaced
8250:4d65b3ec1d31 8251:ee6af20714c3
652 ): 652 ):
653 assign = unparse(node.body[0].targets[0]) 653 assign = unparse(node.body[0].targets[0])
654 body = unparse(node.body[0].value) 654 body = unparse(node.body[0].value)
655 cond = unparse(node.test) 655 cond = unparse(node.test)
656 orelse = unparse(node.orelse[0].value) 656 orelse = unparse(node.orelse[0].value)
657 if len( 657
658 "{0} = {1} if {2} else {3}".format(assign, body, cond, orelse) 658 self.__error(node.lineno - 1, node.col_offset, "Y108",
659 ) < 79: 659 assign, body, cond, orelse)
660 # don't flag an issue, if the ternary would get too complicated
661 self.__error(node.lineno - 1, node.col_offset, "Y108",
662 assign, body, cond, orelse)
663 660
664 def __check109(self, node): 661 def __check109(self, node):
665 """ 662 """
666 Private method to check for multiple equalities with the same value 663 Private method to check for multiple equalities with the same value
667 are combined via "or". 664 are combined via "or".

eric ide

mercurial