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