Home ⌂Doc Index ◂Up ▴

eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker

Module implementing the code style checker.

Global Attributes

None

Classes

CodeStyleCheckerReport Class implementing a special report to be used with our dialog.

Functions

__checkCodeStyle Private module function to perform the code style check and/or fix found errors.
__checkSyntax Private module function to perform a syntax check.
codeStyleBatchCheck Module function to check code style for a batch of files.
codeStyleCheck Do the code style check and/or fix found errors.
extractLineFlags Function to extract flags starting and ending with '__' from a line comment.
ignoreCode Function to check, if the given code should be ignored as per line flags.
initBatchService Initialize the batch service and return the entry point.
initService Initialize the service and return the entry point.
securityOk Function to check, if the given code is an acknowledged security report.
worker Module function acting as the parallel worker for the style check.


CodeStyleCheckerReport

Class implementing a special report to be used with our dialog.

Derived from

pycodestyle.BaseReport

Class Attributes

None

Class Methods

None

Methods

CodeStyleCheckerReport Constructor
error_args Public method to collect the error messages.

Static Methods

None

CodeStyleCheckerReport (Constructor)

CodeStyleCheckerReport(options)

Constructor

options
options for the report (optparse.Values)

CodeStyleCheckerReport.error_args

error_args(line_number, offset, code, check, *args)

Public method to collect the error messages.

line_number
line number of the issue (integer)
offset
position within line of the issue (integer)
code
message code (string)
check
reference to the checker function (function)
args
arguments for the message (list)
Returns:
error code (string)
Up


__checkCodeStyle

__checkCodeStyle(filename, source, args)

Private module function to perform the code style check and/or fix found errors.

filename (str)
source filename
source (str)
string containing the code to check
args (list of (str, str, bool, str, str, bool, int, list of (int, int),)
arguments used by the codeStyleCheck function (list of excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, docType, codeComplexityArgs, miscellaneousArgs, annotationArgs, securityArgs, errors, eol, encoding, backup) bool, str, dict, dict, dict, list of str, str, str, bool)
Returns:
tuple of statistics data and list of result dictionaries with keys:
Return Type:
tuple of (dict, list of dict)
Up


__checkSyntax

__checkSyntax(filename, source)

Private module function to perform a syntax check.

filename (str)
source filename
source (str)
string containing the code to check
Returns:
tuple containing the error dictionary with syntax error details and a statistics dictionary or a tuple containing two None
Return Type:
tuple of (dict, dict) or tuple of (None, None)
Up


codeStyleBatchCheck

codeStyleBatchCheck(argumentsList, send, fx, cancelled, maxProcesses=0)

Module function to check code style for a batch of files.

argumentsList (list)
list of arguments tuples as given for codeStyleCheck
send (func)
reference to send function
fx (str)
registered service name
cancelled (func)
reference to function checking for a cancellation
maxProcesses (int)
number of processes to be used
Up


codeStyleCheck

codeStyleCheck(filename, source, args)

Do the code style check and/or fix found errors.

filename (str)
source filename
source (str)
string containing the code to check
args (list of (str, str, bool, str, str, bool, int, list of (int, int),)
arguments used by the codeStyleCheck function (list of excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors, eol, encoding, backup) bool, str, dict, dict, list of str, str, str, bool)
Returns:
tuple of statistics (dict) and list of results (tuple for each found violation of style (lineno, position, text, ignored, fixed, autofixing, fixedMsg))
Return Type:
tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, str))
Up


extractLineFlags

extractLineFlags(line, startComment=")

Function to extract flags starting and ending with '__' from a line comment.

line
line to extract flags from (string)
startComment=
string identifying the start of the comment (string)
endComment=
string identifying the end of a comment (string)
flagsLine=
flag indicating to check for a flags only line (bool)
Returns:
list containing the extracted flags (list of strings)
Up


ignoreCode

ignoreCode(code, lineFlags)

Function to check, if the given code should be ignored as per line flags.

code (str)
error code to be checked
lineFlags (list of str)
list of line flags to check against
Returns:
flag indicating to ignore the code
Return Type:
bool
Up


initBatchService

initBatchService()

Initialize the batch service and return the entry point.

Returns:
the entry point for the background client (function)
Up


initService

initService()

Initialize the service and return the entry point.

Returns:
the entry point for the background client (function)
Up


securityOk

securityOk(code, lineFlags)

Function to check, if the given code is an acknowledged security report.

code (str)
error code to be checked
lineFlags (list of str)
list of line flags to check against
Returns:
flag indicating an acknowledged security report
Return Type:
bool
Up


worker

worker(inputQueue, outputQueue)

Module function acting as the parallel worker for the style check.

inputQueue
input queue (multiprocessing.Queue)
outputQueue
output queue (multiprocessing.Queue)
Up



Home ⌂Doc Index ◂Up ▴