220 |
220 |
221 def __translateStyleCheck(self, fn, codeStyleCheckerStats, results): |
221 def __translateStyleCheck(self, fn, codeStyleCheckerStats, results): |
222 """ |
222 """ |
223 Private slot called after perfoming a style check on one file. |
223 Private slot called after perfoming a style check on one file. |
224 |
224 |
225 @param fn filename of the just checked file (str) |
225 @param fn filename of the just checked file |
226 @param codeStyleCheckerStats stats of style and name check (dict) |
226 @type str |
227 @param results tuple for each found violation of style (tuple of |
227 @param codeStyleCheckerStats stats of style and name check |
228 lineno (int), position (int), text (str), fixed (bool), |
228 @type dict |
229 autofixing (bool), fixedMsg (str)) |
229 @param results dictionary containing the check result data |
|
230 (see CodesStyleChecker.__checkCodeStyle for details) |
|
231 @type dict |
230 """ |
232 """ |
231 from CheckerPlugins.CodeStyleChecker.translations import ( |
233 from CheckerPlugins.CodeStyleChecker.translations import ( |
232 getTranslatedMessage |
234 getTranslatedMessage |
233 ) |
235 ) |
234 |
236 |
235 fixes = 0 |
237 fixes = 0 |
236 for result in results: |
238 for result in results: |
237 msg = getTranslatedMessage(result[2]) |
239 msg = getTranslatedMessage(result["code"], result["args"]) |
238 |
240 |
239 fixedMsg = result.pop() |
241 if result["fixcode"]: |
240 if fixedMsg: |
|
241 fixes += 1 |
242 fixes += 1 |
242 trFixedMsg = getTranslatedMessage(fixedMsg) |
243 trFixedMsg = getTranslatedMessage(result["fixcode"], |
|
244 result["fixargs"]) |
243 |
245 |
244 msg += "\n" + QCoreApplication.translate( |
246 msg += "\n" + QCoreApplication.translate( |
245 'CodeStyleCheckerDialog', "Fix: {0}").format(trFixedMsg) |
247 'CodeStyleCheckerDialog', "Fix: {0}").format(trFixedMsg) |
246 |
248 |
247 result[2] = msg |
249 result["display"] = msg |
248 self.styleChecked.emit(fn, codeStyleCheckerStats, fixes, results) |
250 self.styleChecked.emit(fn, codeStyleCheckerStats, fixes, results) |
249 |
251 |
250 def activate(self): |
252 def activate(self): |
251 """ |
253 """ |
252 Public method to activate this plugin. |
254 Public method to activate this plugin. |