112 |
112 |
113 def fixIssue(self, line, pos, message): |
113 def fixIssue(self, line, pos, message): |
114 """ |
114 """ |
115 Public method to fix the fixable issues. |
115 Public method to fix the fixable issues. |
116 |
116 |
117 @param line line number of issue (integer or string) |
117 @param line line number of issue (integer) |
118 @param pos character position of issue (integer or string) |
118 @param pos character position of issue (integer) |
119 @param message message text (string) |
119 @param message message text (string) |
120 @return flag indicating an applied fix (boolean) and a message for |
120 @return flag indicating an applied fix (boolean) and a message for |
121 the fix (string) |
121 the fix (string) |
122 """ |
122 """ |
123 code = message.split(None, 1)[0].strip() |
123 code = message.split(None, 1)[0].strip() |
124 |
124 |
125 if (code in self.__fixCodes or len(self.__fixCodes) == 0) and \ |
125 if line <= len(self.__source) and \ |
|
126 (code in self.__fixCodes or len(self.__fixCodes) == 0) and \ |
126 code in self.__fixes: |
127 code in self.__fixes: |
127 res = self.__fixes[code](code, line, pos) |
128 res = self.__fixes[code](code, line, pos) |
128 if res[0]: |
129 if res[0]: |
129 self.__modified = True |
130 self.__modified = True |
130 self.fixed += 1 |
131 self.fixed += 1 |