1700 |
1700 |
1701 def __fixE501(self, code, line, pos, apply=False): |
1701 def __fixE501(self, code, line, pos, apply=False): |
1702 """ |
1702 """ |
1703 Private method to fix the long lines by breaking them. |
1703 Private method to fix the long lines by breaking them. |
1704 |
1704 |
1705 Codes: E501 |
1705 Codes: E-501 |
1706 |
1706 |
1707 @param code code of the issue |
1707 @param code code of the issue |
1708 @type str |
1708 @type str |
1709 @param line line number of the issue |
1709 @param line line number of the issue |
1710 @type int |
1710 @type int |
1746 if newNextText and newNextText != nextText: |
1746 if newNextText and newNextText != nextText: |
1747 if newNextText == " ": |
1747 if newNextText == " ": |
1748 newNextText = "" |
1748 newNextText = "" |
1749 self.__source[line + 1] = newNextText |
1749 self.__source[line + 1] = newNextText |
1750 # Long lines have been shortened. |
1750 # Long lines have been shortened. |
1751 return (1, "FIX-E501", [], 0) |
1751 return (1, "FIX-E-501", [], 0) |
1752 else: |
1752 else: |
1753 return (0, "", [], 0) |
1753 return (0, "", [], 0) |
1754 else: |
1754 else: |
1755 fixId = self.__getID() |
1755 fixId = self.__getID() |
1756 self.__stack.append((fixId, code, line, pos)) |
1756 self.__stack.append((fixId, code, line, pos)) |
3053 @return number of unmatched open/close brackets |
3053 @return number of unmatched open/close brackets |
3054 @rtype int |
3054 @rtype int |
3055 """ |
3055 """ |
3056 count = 0 |
3056 count = 0 |
3057 for opening, closing in ["()", "[]", "{}"]: |
3057 for opening, closing in ["()", "[]", "{}"]: |
3058 # __IGNORE_WARNING_M613__ |
3058 # __IGNORE_WARNING_M-613__ |
3059 count += abs(line.count(opening) - line.count(closing)) |
3059 count += abs(line.count(opening) - line.count(closing)) |
3060 |
3060 |
3061 return count |
3061 return count |
3062 |
3062 |
3063 def __getIndent(self, line): |
3063 def __getIndent(self, line): |