202 """ |
202 """ |
203 Do the source code style check and/or fix found errors. |
203 Do the source code style check and/or fix found errors. |
204 |
204 |
205 @param filename source filename |
205 @param filename source filename |
206 @type str |
206 @type str |
207 @param source string containing the source code to check |
207 @param source list of code lines to be checked |
208 @type str |
208 @type list of str |
209 @param args arguments used by the codeStyleCheck function (list of |
209 @param args arguments used by the codeStyleCheck function (list of |
210 excludeMessages, includeMessages, repeatMessages, fixCodes, |
210 excludeMessages, includeMessages, repeatMessages, fixCodes, |
211 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
211 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
212 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, |
212 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, |
213 annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors, |
213 annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors, |
321 """ |
321 """ |
322 Private module function to perform a syntax check. |
322 Private module function to perform a syntax check. |
323 |
323 |
324 @param filename source filename |
324 @param filename source filename |
325 @type str |
325 @type str |
326 @param source string containing the source code to check |
326 @param source list of code lines to be checked |
327 @type str |
327 @type list of str |
328 @return tuple containing the error dictionary with syntax error details, |
328 @return tuple containing the error dictionary with syntax error details, |
329 a statistics dictionary and None or a tuple containing two None and |
329 a statistics dictionary and None or a tuple containing two None and |
330 the generated AST tree |
330 the generated AST tree |
331 @rtype tuple of (dict, dict, None) or tuple of (None, None, ast.Module) |
331 @rtype tuple of (dict, dict, None) or tuple of (None, None, ast.Module) |
332 """ |
332 """ |
364 Private module function to perform the source code style check and/or fix |
364 Private module function to perform the source code style check and/or fix |
365 found errors. |
365 found errors. |
366 |
366 |
367 @param filename source filename |
367 @param filename source filename |
368 @type str |
368 @type str |
369 @param source string containing the source code to check |
369 @param source list of code lines to be checked |
370 @type str |
370 @type list of str |
371 @param args arguments used by the codeStyleCheck function (list of |
371 @param args arguments used by the codeStyleCheck function (list of |
372 excludeMessages, includeMessages, repeatMessages, fixCodes, |
372 excludeMessages, includeMessages, repeatMessages, fixCodes, |
373 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
373 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, |
374 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, |
374 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, |
375 annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors, |
375 annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors, |
463 ignore=ignore, |
463 ignore=ignore, |
464 max_line_length=maxLineLength, |
464 max_line_length=maxLineLength, |
465 max_doc_length=maxDocLineLength, |
465 max_doc_length=maxDocLineLength, |
466 hang_closing=hangClosing, |
466 hang_closing=hangClosing, |
467 ) |
467 ) |
468 report = styleGuide.check_files([filename]) |
468 report = styleGuide.options.report |
|
469 styleGuide.input_file(filename, lines=source) |
469 stats.update(report.counters) |
470 stats.update(report.counters) |
470 errors = report.errors |
471 errors = report.errors |
471 |
472 |
472 # check documentation style |
473 # check documentation style |
473 docStyleChecker = DocStyleChecker( |
474 docStyleChecker = DocStyleChecker( |