175 @param source string containing the code to check |
175 @param source string containing the code to check |
176 @type str |
176 @type str |
177 @param args arguments used by the codeStyleCheck function (list of |
177 @param args arguments used by the codeStyleCheck function (list of |
178 excludeMessages, includeMessages, repeatMessages, fixCodes, |
178 excludeMessages, includeMessages, repeatMessages, fixCodes, |
179 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
179 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
180 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors, |
180 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, |
181 eol, encoding, backup) |
181 annotationArgs, securityArgs, importsArgs, errors, eol, encoding, |
|
182 backup) |
182 @type list of (str, str, bool, str, str, bool, int, list of (int, int), |
183 @type list of (str, str, bool, str, str, bool, int, list of (int, int), |
183 bool, str, dict, dict, list of str, str, str, bool) |
184 bool, str, dict, dict, dict, dict, list of str, str, str, bool) |
184 @return tuple of statistics (dict) and list of results (tuple for each |
185 @return tuple of statistics (dict) and list of results (tuple for each |
185 found violation of style (lineno, position, text, ignored, fixed, |
186 found violation of style (lineno, position, text, ignored, fixed, |
186 autofixing, fixedMsg)) |
187 autofixing, fixedMsg)) |
187 @rtype tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, |
188 @rtype tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, |
188 str)) |
189 str)) |
336 @type str |
337 @type str |
337 @param args arguments used by the codeStyleCheck function (list of |
338 @param args arguments used by the codeStyleCheck function (list of |
338 excludeMessages, includeMessages, repeatMessages, fixCodes, |
339 excludeMessages, includeMessages, repeatMessages, fixCodes, |
339 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
340 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
340 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, |
341 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, |
341 annotationArgs, securityArgs, errors, eol, encoding, backup) |
342 annotationArgs, securityArgs, importsArgs, errors, eol, encoding, |
|
343 backup) |
342 @type list of (str, str, bool, str, str, bool, int, list of (int, int), |
344 @type list of (str, str, bool, str, str, bool, int, list of (int, int), |
343 bool, str, dict, dict, dict, list of str, str, str, bool) |
345 bool, str, dict, dict, dict, dict, list of str, str, str, bool) |
344 @return tuple of statistics data and list of result dictionaries with |
346 @return tuple of statistics data and list of result dictionaries with |
345 keys: |
347 keys: |
346 <ul> |
348 <ul> |
347 <li>file: file name</li> |
349 <li>file: file name</li> |
348 <li>line: line_number</li> |
350 <li>line: line_number</li> |
358 @rtype tuple of (dict, list of dict) |
360 @rtype tuple of (dict, list of dict) |
359 """ |
361 """ |
360 (excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, |
362 (excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, |
361 fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, |
363 fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, |
362 docType, codeComplexityArgs, miscellaneousArgs, annotationArgs, |
364 docType, codeComplexityArgs, miscellaneousArgs, annotationArgs, |
363 securityArgs, errors, eol, encoding, backup) = args |
365 securityArgs, importsArgs, errors, eol, encoding, backup) = args |
364 |
366 |
365 stats = {} |
367 stats = {} |
366 |
368 |
367 if fixIssues: |
369 if fixIssues: |
368 from CodeStyleFixer import CodeStyleFixer |
370 from CodeStyleFixer import CodeStyleFixer |
466 stats.update(simplifyChecker.counters) |
468 stats.update(simplifyChecker.counters) |
467 errors += simplifyChecker.errors |
469 errors += simplifyChecker.errors |
468 |
470 |
469 # check import statements |
471 # check import statements |
470 importsChecker = ImportsChecker( |
472 importsChecker = ImportsChecker( |
471 source, filename, tree, select, ignore, [], repeatMessages, {}) |
473 source, filename, tree, select, ignore, [], repeatMessages, |
472 # TODO: add arguments |
474 importsArgs) |
473 importsChecker.run() |
475 importsChecker.run() |
474 stats.update(importsChecker.counters) |
476 stats.update(importsChecker.counters) |
475 errors += importsChecker.errors |
477 errors += importsChecker.errors |
476 |
478 |
477 elif syntaxError: |
479 elif syntaxError: |