Sat, 06 Jun 2020 19:42:15 +0200
Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
--- a/eric6/APIs/Python3/eric6.api Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/APIs/Python3/eric6.api Sat Jun 06 19:42:15 2020 +0200 @@ -2939,6 +2939,7 @@ eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.initBatchService?4() eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.initService?4() eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.worker?4(inputQueue, outputQueue) +eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.CodeStyleCheckerDialog.argsRole?7 eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.CodeStyleCheckerDialog.availableFutures?7 eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.CodeStyleCheckerDialog.check?4(codestring='') eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.CodeStyleCheckerDialog.checkBatch?4() @@ -2977,7 +2978,7 @@ eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCodeSelectionDialog.CodeStyleCodeSelectionDialog.getSelectedCodes?4() eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCodeSelectionDialog.CodeStyleCodeSelectionDialog?1(codes, categories, showFixCodes, parent=None) eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.CodeStyleFixer.finalize?4() -eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.CodeStyleFixer.fixIssue?4(line, pos, message) +eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.CodeStyleFixer.fixIssue?4(line, pos, code) eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.CodeStyleFixer.mutualStartswith?4(b) eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.CodeStyleFixer.saveFile?4(encoding) eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.CodeStyleFixer?1(filename, sourceLines, fixCodes, noFixCodes, maxLineLength, blankLines, inPlace, eol, backup=False) @@ -3255,7 +3256,7 @@ eric6.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.whitespace_before_parameters?4(logical_line, tokens) eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations._messages?8 eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations._messages_sample_args?8 -eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations.getTranslatedMessage?4(message) +eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations.getTranslatedMessage?4(messageCode, messageArgs) eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.VcsConflictMarkerRegExpList?7 eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.extractLineFlags?4(line, startComment=") eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.initBatchService?4()
--- a/eric6/Documentation/Help/source.qhp Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Documentation/Help/source.qhp Sat Jun 06 19:42:15 2020 +0200 @@ -2499,6 +2499,7 @@ <keyword name="CodeStyleCheckerDialog.__cleanupData" id="CodeStyleCheckerDialog.__cleanupData" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__cleanupData" /> <keyword name="CodeStyleCheckerDialog.__clearErrors" id="CodeStyleCheckerDialog.__clearErrors" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__clearErrors" /> <keyword name="CodeStyleCheckerDialog.__createErrorItem" id="CodeStyleCheckerDialog.__createErrorItem" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__createErrorItem" /> + <keyword name="CodeStyleCheckerDialog.__createFileErrorItem" id="CodeStyleCheckerDialog.__createFileErrorItem" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__createFileErrorItem" /> <keyword name="CodeStyleCheckerDialog.__createResultItem" id="CodeStyleCheckerDialog.__createResultItem" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__createResultItem" /> <keyword name="CodeStyleCheckerDialog.__finish" id="CodeStyleCheckerDialog.__finish" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__finish" /> <keyword name="CodeStyleCheckerDialog.__getBuiltinsIgnoreList" id="CodeStyleCheckerDialog.__getBuiltinsIgnoreList" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__getBuiltinsIgnoreList" />
--- a/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html Sat Jun 06 19:42:15 2020 +0200 @@ -199,16 +199,26 @@ <dl> <dt>Returns:</dt> <dd> -tuple of statistics (dict) and list of results (tuple for each - found violation of style (lineno, position, text, ignored, fixed, - autofixing, fixedMsg)) +tuple of statistics data and list of result dictionaries with + keys: + <ul> + <li>file: file name</li> + <li>line: line_number</li> + <li>offset: offset within line</li> + <li>code: message code</li> + <li>args: list of arguments to format the message</li> + <li>ignored: flag indicating this issue was ignored</li> + <li>fixed: flag indicating this issue was fixed</li> + <li>autofixing: flag indicating that a fix can be done</li> + <li>fixcode: message code for the fix</li> + <li>fixargs: list of arguments to format the fix message</li> + </ul> </dd> </dl> <dl> <dt>Return Type:</dt> <dd> -tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, - str)) +tuple of (dict, list of dict) </dd> </dl> <div align="right"><a href="#top">Up</a></div>
--- a/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html Sat Jun 06 19:42:15 2020 +0200 @@ -57,7 +57,7 @@ <h3>Class Attributes</h3> <table> -<tr><td>availableFutures</td></tr><tr><td>checkCategories</td></tr><tr><td>codeRole</td></tr><tr><td>filenameRole</td></tr><tr><td>fixableRole</td></tr><tr><td>hasResults</td></tr><tr><td>ignoredRole</td></tr><tr><td>lineRole</td></tr><tr><td>messageRole</td></tr><tr><td>noFiles</td></tr><tr><td>noResults</td></tr><tr><td>positionRole</td></tr> +<tr><td>argsRole</td></tr><tr><td>availableFutures</td></tr><tr><td>checkCategories</td></tr><tr><td>codeRole</td></tr><tr><td>filenameRole</td></tr><tr><td>fixableRole</td></tr><tr><td>hasResults</td></tr><tr><td>ignoredRole</td></tr><tr><td>lineRole</td></tr><tr><td>messageRole</td></tr><tr><td>noFiles</td></tr><tr><td>noResults</td></tr><tr><td>positionRole</td></tr> </table> <h3>Class Methods</h3> @@ -93,6 +93,10 @@ <td>Private slot to create a new error item in the result list.</td> </tr> <tr> +<td><a href="#CodeStyleCheckerDialog.__createFileErrorItem">__createFileErrorItem</a></td> +<td>Private method to create an error entry for a given file.</td> +</tr> +<tr> <td><a href="#CodeStyleCheckerDialog.__createResultItem">__createResultItem</a></td> <td>Private method to create an entry in the result list.</td> </tr> @@ -351,9 +355,27 @@ error message </dd> </dl> +<a NAME="CodeStyleCheckerDialog.__createFileErrorItem" ID="CodeStyleCheckerDialog.__createFileErrorItem"></a> +<h4>CodeStyleCheckerDialog.__createFileErrorItem</h4> +<b>__createFileErrorItem</b>(<i>filename, message</i>) + +<p> + Private method to create an error entry for a given file. +</p> +<dl> + +<dt><i>filename</i> (str)</dt> +<dd> +file name of the file +</dd> +<dt><i>message</i> (str)</dt> +<dd> +error message text +</dd> +</dl> <a NAME="CodeStyleCheckerDialog.__createResultItem" ID="CodeStyleCheckerDialog.__createResultItem"></a> <h4>CodeStyleCheckerDialog.__createResultItem</h4> -<b>__createResultItem</b>(<i>filename, line, pos, message, fixed, autofixing, ignored</i>) +<b>__createResultItem</b>(<i>filename, result</i>) <p> Private method to create an entry in the result list. @@ -364,30 +386,9 @@ <dd> file name of the file </dd> -<dt><i>line</i> (int or str)</dt> -<dd> -line number of issue -</dd> -<dt><i>pos</i> (int or str)</dt> -<dd> -character position of issue -</dd> -<dt><i>message</i> (str)</dt> +<dt><i>result</i> (dict)</dt> <dd> -message text -</dd> -<dt><i>fixed</i> (bool)</dt> -<dd> -flag indicating a fixed issue -</dd> -<dt><i>autofixing</i> (bool)</dt> -<dd> -flag indicating, that we are fixing issues - automatically -</dd> -<dt><i>ignored</i> (bool)</dt> -<dd> -flag indicating an ignored issue +dictionary containing check result data </dd> </dl> <dl> @@ -597,7 +598,7 @@ </dl> <a NAME="CodeStyleCheckerDialog.__modifyFixedResultItem" ID="CodeStyleCheckerDialog.__modifyFixedResultItem"></a> <h4>CodeStyleCheckerDialog.__modifyFixedResultItem</h4> -<b>__modifyFixedResultItem</b>(<i>itm, text, fixed</i>) +<b>__modifyFixedResultItem</b>(<i>itm, result</i>) <p> Private method to modify a result list entry to show its @@ -609,13 +610,9 @@ <dd> reference to the item to modify </dd> -<dt><i>text</i> (str)</dt> +<dt><i>result</i> (dict)</dt> <dd> -text to be appended -</dd> -<dt><i>fixed</i> (bool)</dt> -<dd> -flag indicating a fixed issue +dictionary containing check result data </dd> </dl> <a NAME="CodeStyleCheckerDialog.__modifyOptions" ID="CodeStyleCheckerDialog.__modifyOptions"></a> @@ -688,10 +685,9 @@ <dd> number of applied fixes </dd> -<dt><i>results</i> (tuplt of tuple of (int, int, str, bool, bool, bool))</dt> +<dt><i>results</i> (dict)</dt> <dd> -tuple for each found violation of style (tuple of - lineno, position, text, ignored, fixed, autofixing) +dictionary containing check result data </dd> </dl> <a NAME="CodeStyleCheckerDialog.__resetStatistics" ID="CodeStyleCheckerDialog.__resetStatistics"></a>
--- a/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html Sat Jun 06 19:42:15 2020 +0200 @@ -402,30 +402,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD111" ID="CodeStyleFixer.__fixD111"></a> @@ -440,25 +445,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD112" ID="CodeStyleFixer.__fixD112"></a> @@ -473,25 +484,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD121" ID="CodeStyleFixer.__fixD121"></a> @@ -506,30 +523,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD131" ID="CodeStyleFixer.__fixD131"></a> @@ -545,25 +567,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD141" ID="CodeStyleFixer.__fixD141"></a> @@ -579,30 +607,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD142" ID="CodeStyleFixer.__fixD142"></a> @@ -618,30 +651,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD143" ID="CodeStyleFixer.__fixD143"></a> @@ -657,30 +695,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD144" ID="CodeStyleFixer.__fixD144"></a> @@ -696,30 +739,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD145" ID="CodeStyleFixer.__fixD145"></a> @@ -735,30 +783,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD221" ID="CodeStyleFixer.__fixD221"></a> @@ -774,30 +827,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD242" ID="CodeStyleFixer.__fixD242"></a> @@ -813,30 +871,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD243" ID="CodeStyleFixer.__fixD243"></a> @@ -852,30 +915,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixD247" ID="CodeStyleFixer.__fixD247"></a> @@ -891,30 +959,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE101" ID="CodeStyleFixer.__fixE101"></a> @@ -929,25 +1002,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE121" ID="CodeStyleFixer.__fixE121"></a> @@ -963,30 +1042,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE122" ID="CodeStyleFixer.__fixE122"></a> @@ -1001,30 +1085,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE123" ID="CodeStyleFixer.__fixE123"></a> @@ -1039,30 +1128,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE125" ID="CodeStyleFixer.__fixE125"></a> @@ -1078,30 +1172,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE126" ID="CodeStyleFixer.__fixE126"></a> @@ -1117,30 +1216,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE127" ID="CodeStyleFixer.__fixE127"></a> @@ -1155,30 +1259,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE201" ID="CodeStyleFixer.__fixE201"></a> @@ -1193,25 +1302,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE221" ID="CodeStyleFixer.__fixE221"></a> @@ -1227,25 +1342,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE225" ID="CodeStyleFixer.__fixE225"></a> @@ -1260,25 +1381,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE231" ID="CodeStyleFixer.__fixE231"></a> @@ -1293,25 +1420,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE251" ID="CodeStyleFixer.__fixE251"></a> @@ -1327,25 +1460,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE261" ID="CodeStyleFixer.__fixE261"></a> @@ -1360,25 +1499,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE304" ID="CodeStyleFixer.__fixE304"></a> @@ -1394,30 +1539,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE401" ID="CodeStyleFixer.__fixE401"></a> @@ -1432,30 +1582,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE501" ID="CodeStyleFixer.__fixE501"></a> @@ -1470,30 +1625,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE502" ID="CodeStyleFixer.__fixE502"></a> @@ -1508,25 +1668,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE701" ID="CodeStyleFixer.__fixE701"></a> @@ -1541,30 +1707,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE702" ID="CodeStyleFixer.__fixE702"></a> @@ -1579,30 +1750,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixE711" ID="CodeStyleFixer.__fixE711"></a> @@ -1617,25 +1793,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixN804" ID="CodeStyleFixer.__fixN804"></a> @@ -1651,30 +1833,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixN806" ID="CodeStyleFixer.__fixN806"></a> @@ -1689,30 +1876,35 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> -<dt><i>apply=</i></dt> +<dt><i>apply</i> (bool)</dt> <dd> flag indicating, that the fix should be applied - (boolean) </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixReindent" ID="CodeStyleFixer.__fixReindent"></a> @@ -1758,25 +1950,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixW292" ID="CodeStyleFixer.__fixW292"></a> @@ -1791,25 +1989,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixW391" ID="CodeStyleFixer.__fixW391"></a> @@ -1824,25 +2028,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixW603" ID="CodeStyleFixer.__fixW603"></a> @@ -1857,25 +2067,31 @@ </p> <dl> -<dt><i>code</i></dt> +<dt><i>code</i> (str)</dt> <dd> -code of the issue (string) +code of the issue </dd> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of the issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -position inside line (integer) +position inside line </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list or int, int) </dd> </dl> <a NAME="CodeStyleFixer.__fixWhitespace" ID="CodeStyleFixer.__fixWhitespace"></a> @@ -2011,32 +2227,38 @@ </dl> <a NAME="CodeStyleFixer.fixIssue" ID="CodeStyleFixer.fixIssue"></a> <h4>CodeStyleFixer.fixIssue</h4> -<b>fixIssue</b>(<i>line, pos, message</i>) +<b>fixIssue</b>(<i>line, pos, code</i>) <p> Public method to fix the fixable issues. </p> <dl> -<dt><i>line</i></dt> +<dt><i>line</i> (int)</dt> <dd> -line number of issue (integer) +line number of the issue </dd> -<dt><i>pos</i></dt> +<dt><i>pos</i> (int)</dt> <dd> -character position of issue (integer) +position inside line </dd> -<dt><i>message</i></dt> +<dt><i>code</i> (str)</dt> <dd> -message text (string) +code of the issue </dd> </dl> <dl> <dt>Returns:</dt> <dd> value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, arguments list for the message + and an ID for a deferred fix +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, str, list, int) </dd> </dl> <a NAME="CodeStyleFixer.mutualStartswith" ID="CodeStyleFixer.mutualStartswith"></a>
--- a/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations.html Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations.html Sat Jun 06 19:42:15 2020 +0200 @@ -48,7 +48,7 @@ <hr /> <a NAME="getTranslatedMessage" ID="getTranslatedMessage"></a> <h2>getTranslatedMessage</h2> -<b>getTranslatedMessage</b>(<i>message</i>) +<b>getTranslatedMessage</b>(<i>messageCode, messageArgs</i>) <p> Module function to get a translated and formatted message for a @@ -56,9 +56,14 @@ </p> <dl> -<dt><i>message</i> (str)</dt> +<dt><i>messageCode</i> (str)</dt> <dd> -the message ID +the message code +</dd> +<dt><i>messageArgs</i> (list or int)</dt> +<dd> +list of arguments or a single integer value to format + the message </dd> </dl> <dl>
--- a/eric6/Documentation/Source/eric6.Plugins.PluginCodeStyleChecker.html Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Documentation/Source/eric6.Plugins.PluginCodeStyleChecker.html Sat Jun 06 19:42:15 2020 +0200 @@ -332,19 +332,18 @@ </p> <dl> -<dt><i>fn</i></dt> +<dt><i>fn</i> (str)</dt> <dd> -filename of the just checked file (str) +filename of the just checked file </dd> -<dt><i>codeStyleCheckerStats</i></dt> +<dt><i>codeStyleCheckerStats</i> (dict)</dt> <dd> -stats of style and name check (dict) +stats of style and name check </dd> -<dt><i>results</i></dt> +<dt><i>results</i> (dict)</dt> <dd> -tuple for each found violation of style (tuple of - lineno (int), position (int), text (str), fixed (bool), - autofixing (bool), fixedMsg (str)) +dictionary containing the check result data + (see CodesStyleChecker.__checkCodeStyle for details) </dd> </dl> <a NAME="CodeStyleCheckerPlugin.activate" ID="CodeStyleCheckerPlugin.activate"></a>
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/AnnotationsChecker.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/AnnotationsChecker.py Sat Jun 06 19:42:15 2020 +0200 @@ -130,7 +130,14 @@ if code and (self.counters[code] == 1 or self.__repeat): # record the issue with one based line number self.errors.append( - (self.__filename, lineNumber + 1, offset, (code, args))) + { + "file": self.__filename, + "line": lineNumber + 1, + "offset": offset, + "code": code, + "args": args, + } + ) def __reportInvalidSyntax(self): """
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Sat Jun 06 19:42:15 2020 +0200 @@ -74,7 +74,13 @@ line_number, offset, code, check, *args) if code and (self.counters[code] == 1 or self.__repeat): self.errors.append( - (self.filename, line_number, offset, (code, args)) + { + "file": self.filename, + "line": line_number, + "offset": offset, + "code": code, + "args": args, + } ) return code @@ -261,11 +267,21 @@ annotationArgs, errors, eol, encoding, backup) @type list of (str, str, bool, str, str, bool, int, list of (int, int), bool, str, dict, dict, list of str, str, str, bool) - @return tuple of statistics (dict) and list of results (tuple for each - found violation of style (lineno, position, text, ignored, fixed, - autofixing, fixedMsg)) - @rtype tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, - str)) + @return tuple of statistics data and list of result dictionaries with + keys: + <ul> + <li>file: file name</li> + <li>line: line_number</li> + <li>offset: offset within line</li> + <li>code: message code</li> + <li>args: list of arguments to format the message</li> + <li>ignored: flag indicating this issue was ignored</li> + <li>fixed: flag indicating this issue was fixed</li> + <li>autofixing: flag indicating that a fix can be done</li> + <li>fixcode: message code for the fix</li> + <li>fixargs: list of arguments to format the fix message</li> + </ul> + @rtype tuple of (dict, list of dict) """ (excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, @@ -322,7 +338,7 @@ report = styleGuide.check_files([filename]) stats.update(report.counters) errors = report.errors - + # check documentation style docStyleChecker = DocStyleChecker( source, filename, select, ignore, [], repeatMessages, @@ -358,19 +374,19 @@ errors += annotationsChecker.errors errorsDict = {} - for _fname, lineno, position, text in errors: - if lineno > len(source): - lineno = len(source) + for error in errors: + if error["line"] > len(source): + error["line"] = len(source) # inverse processing of messages and fixes - errorLine = errorsDict.setdefault(lineno, []) - errorLine.append([position, text]) + errorLine = errorsDict.setdefault(error["line"], []) + errorLine.append((error["offset"], error)) deferredFixes = {} results = [] - for lineno, errors in errorsDict.items(): - errors.sort(key=lambda x: x[0], reverse=True) - for position, text in errors: + for lineno, errorsList in errorsDict.items(): + errorsList.sort(key=lambda x: x[0], reverse=True) + for _, error in errorsList: if source: - code = text[0] + code = error["code"] lineFlags = extractLineFlags(source[lineno - 1].strip()) try: lineFlags += extractLineFlags(source[lineno].strip(), @@ -379,35 +395,66 @@ pass if not ignoreCode(code, lineFlags): if fixer: - res, msg, id_ = fixer.fixIssue(lineno, position, text) + pass + res, fixcode, fixargs, id_ = fixer.fixIssue( + lineno, error["offset"], code) if res == -1: - itm = [lineno, position, text] - deferredFixes[id_] = itm + deferredFixes[id_] = error else: - itm = [lineno, position, text, False, - res == 1, True, msg] + error.update({ + "ignored": False, + "fixed": res == 1, + "autofixing": True, + "fixcode": fixcode, + "fixargs": fixargs, + }) else: - itm = [lineno, position, text, False, - False, False, ''] - results.append(itm) + error.update({ + "ignored": False, + "fixed": False, + "autofixing": False, + "fixcode": "", + "fixargs": [], + }) else: - results.append([lineno, position, text, True, - False, False, '']) + error.update({ + "ignored": True, + "fixed": False, + "autofixing": False, + "fixcode": "", + "fixargs": [], + }) else: - results.append([lineno, position, text, False, - False, False, '']) + error.update({ + "ignored": False, + "fixed": False, + "autofixing": False, + "fixcode": "", + "fixargs": [], + }) + + results.append(error) if fixer: deferredResults = fixer.finalize() for id_ in deferredResults: - fixed, msg = deferredResults[id_] - itm = deferredFixes[id_] - itm.extend([False, fixed == 1, True, msg]) + fixed, fixcode, fixargs = deferredResults[id_] + error = deferredFixes[id_] + error.update({ + "ignored": False, + "fixed": fixed == 1, + "autofixing": True, + "fixcode": fixcode, + "fixargs": fixargs, + }) - errMsg = fixer.saveFile(encoding) - if errMsg: - for result in results: - result[-1] = errMsg + saveError = fixer.saveFile(encoding) + if saveError: + for error in results: + error.update({ + "fixcode": saveError[0], + "fixargs": saveError[1], + }) return stats, results
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sat Jun 06 19:42:15 2020 +0200 @@ -45,6 +45,7 @@ fixableRole = Qt.UserRole + 5 codeRole = Qt.UserRole + 6 ignoredRole = Qt.UserRole + 7 + argsRole = Qt.UserRole + 8 availableFutures = [ 'division', 'absolute_import', 'with_statement', @@ -199,26 +200,36 @@ itm.setForeground(0, Qt.red) itm.setFirstColumnSpanned(True) - def __createResultItem(self, filename, line, pos, message, fixed, - autofixing, ignored): + def __createFileErrorItem(self, filename, message): + """ + Private method to create an error entry for a given file. + + @param filename file name of the file + @type str + @param message error message text + @type str + """ + result = { + "file": filename, + "line": 1, + "offset": 1, + "code": "", + "args": [], + "display": self.tr("Error: {0}").format(message).rstrip(), + "fixed": False, + "autofixing": False, + "ignored": False, + } + self.__createResultItem(filename, result) + + def __createResultItem(self, filename, result): """ Private method to create an entry in the result list. @param filename file name of the file @type str - @param line line number of issue - @type int or str - @param pos character position of issue - @type int or str - @param message message text - @type str - @param fixed flag indicating a fixed issue - @type bool - @param autofixing flag indicating, that we are fixing issues - automatically - @type bool - @param ignored flag indicating an ignored issue - @type bool + @param result dictionary containing check result data + @type dict @return reference to the created item @rtype QTreeWidgetItem """ @@ -233,23 +244,24 @@ self.__lastFileItem.setData(0, self.filenameRole, filename) fixable = False - code, message = message.split(None, 1) itm = QTreeWidgetItem( self.__lastFileItem, - ["{0:6}".format(line), code, message]) - if code.startswith(("W", "-", "C", "M")): + ["{0:6}".format(result["line"]), result["code"], + result["display"]]) + if result["code"].startswith(("W", "-", "C", "M")): itm.setIcon(1, UI.PixmapCache.getIcon("warning")) - elif code.startswith(("A", "N")): + elif result["code"].startswith(("A", "N")): itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) - elif code.startswith("D"): + elif result["code"].startswith("D"): itm.setIcon(1, UI.PixmapCache.getIcon("docstringError")) else: itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError")) - if fixed: + if result["fixed"]: itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed")) elif ( - code in FixableCodeStyleIssues and not autofixing and - code not in self.__noFixCodesList + result["code"] in FixableCodeStyleIssues and + not result["autofixing"] and + result["code"] not in self.__noFixCodesList ): itm.setIcon(0, UI.PixmapCache.getIcon("issueFixable")) fixable = True @@ -262,14 +274,15 @@ itm.setTextAlignment(2, Qt.AlignVCenter) itm.setData(0, self.filenameRole, filename) - itm.setData(0, self.lineRole, int(line)) - itm.setData(0, self.positionRole, int(pos)) - itm.setData(0, self.messageRole, message) + itm.setData(0, self.lineRole, int(result["line"])) + itm.setData(0, self.positionRole, int(result["offset"])) + itm.setData(0, self.messageRole, result["display"]) itm.setData(0, self.fixableRole, fixable) - itm.setData(0, self.codeRole, code) - itm.setData(0, self.ignoredRole, ignored) + itm.setData(0, self.codeRole, result["code"]) + itm.setData(0, self.ignoredRole, result["ignored"]) + itm.setData(0, self.argsRole, result["args"]) - if ignored: + if result["ignored"]: font = itm.font(0) font.setItalic(True) for col in range(itm.columnCount()): @@ -277,24 +290,21 @@ return itm - def __modifyFixedResultItem(self, itm, text, fixed): + def __modifyFixedResultItem(self, itm, result): """ Private method to modify a result list entry to show its positive fixed state. @param itm reference to the item to modify @type QTreeWidgetItem - @param text text to be appended - @type str - @param fixed flag indicating a fixed issue - @type bool + @param result dictionary containing check result data + @type dict """ - if fixed: - code, message = text.split(None, 1) - itm.setText(2, message) + if result["fixed"]: + itm.setText(2, result["display"]) itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed")) - itm.setData(0, self.messageRole, message) + itm.setData(0, self.messageRole, result["display"]) else: itm.setIcon(0, QIcon()) itm.setData(0, self.fixableRole, False) @@ -651,10 +661,7 @@ source = source.splitlines(True) except (UnicodeError, IOError) as msg: self.results = CodeStyleCheckerDialog.hasResults - self.__createResultItem( - self.filename, 1, 1, - self.tr("Error: {0}").format(str(msg)) - .rstrip(), False, False, False) + self.__createFileErrorItem(self.filename, str(msg)) self.progress += 1 # Continue with next file self.check() @@ -702,10 +709,7 @@ source = source.splitlines(True) except (UnicodeError, IOError) as msg: self.results = CodeStyleCheckerDialog.hasResults - self.__createResultItem( - filename, 1, 1, - self.tr("Error: {0}").format(str(msg)) - .rstrip(), False, False, False) + self.__createFileErrorItem(filename, str(msg)) continue if encoding.endswith( @@ -768,9 +772,8 @@ @type dict @param fixes number of applied fixes @type int - @param results tuple for each found violation of style (tuple of - lineno, position, text, ignored, fixed, autofixing) - @type tuplt of tuple of (int, int, str, bool, bool, bool) + @param results dictionary containing check result data + @type dict """ if self.__finished: return @@ -787,23 +790,23 @@ fixed = None ignoredErrors = 0 if self.__itms: - for itm, (_lineno, _position, text, _ignored, fixed, - _autofixing) in zip(self.__itms, results): - self.__modifyFixedResultItem(itm, text, fixed) + for itm, result in zip(self.__itms, results): + self.__modifyFixedResultItem(itm, result) self.__updateFixerStatistics(fixes) else: self.__lastFileItem = None - for lineno, position, text, ignored, fixed, autofixing in results: - if ignored: + for result in results: + if result["ignored"]: ignoredErrors += 1 if self.showIgnored: - text = self.tr("{0} (ignored)").format(text) + result["display"] = self.tr( + "{0} (ignored)" + ).format(result["display"]) else: continue self.results = CodeStyleCheckerDialog.hasResults - self.__createResultItem( - fn, lineno, position, text, fixed, autofixing, ignored) + self.__createResultItem(fn, result) self.__updateStatistics( codeStyleCheckerStats, fixes, ignoredErrors) @@ -1323,10 +1326,14 @@ if filename not in fixesDict: fixesDict[filename] = [] fixesDict[filename].append(( - (filename, itm.data(0, self.lineRole), - itm.data(0, self.positionRole), - "{0} {1}".format(itm.data(0, self.codeRole), - itm.data(0, self.messageRole))), + { + "file": filename, + "line": itm.data(0, self.lineRole), + "offset": itm.data(0, self.positionRole), + "code": itm.data(0, self.codeRole), + "display": itm.data(0, self.messageRole), + "args": itm.data(0, self.argsRole), + }, itm ))
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sat Jun 06 19:42:15 2020 +0200 @@ -18,8 +18,8 @@ import re import tokenize -# CodeStyleCheckerDialog tries to import FixableCodeStyleIssues what fail under -# Python3. So ignore it. +# CodeStyleCheckerDialog tries to import FixableCodeStyleIssues which fails +# under Python3. So ignore it. try: import pycodestyle except ImportError: @@ -238,7 +238,7 @@ fp.write(txt) except (IOError, UnicodeError) as err: # Could not save the file! Skipping it. Reason: {0} - return ("FIXWRITE_ERROR", (str(err),)) + return ("FIXWRITE_ERROR", [str(err)]) return None @@ -272,22 +272,21 @@ return True - def fixIssue(self, line, pos, message): + def fixIssue(self, line, pos, code): """ Public method to fix the fixable issues. - @param line line number of issue (integer) - @param pos character position of issue (integer) - @param message message text (string) + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param code code of the issue + @type str @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, arguments list for the message + and an ID for a deferred fix + @rtype tuple of (int, str, list, int) """ - if isinstance(message, (tuple, list)): - code = message[0].strip() - else: - code = message.split(None, 1)[0].strip() - if ( line <= len(self.__source) and self.__codeMatch(code) and @@ -298,7 +297,7 @@ self.__modified = True self.fixed += 1 else: - res = (0, "", 0) + res = (0, "", [], 0) return res @@ -312,19 +311,19 @@ # step 1: do fixes operating on logical lines first for id_, code, line, pos in self.__stackLogical: - res, msg, _ = self.__fixes[code](code, line, pos, apply=True) + res, msg, args, _ = self.__fixes[code](code, line, pos, apply=True) if res == 1: self.__modified = True self.fixed += 1 - results[id_] = (res, msg) + results[id_] = (res, msg, args) # step 2: do fixes that change the number of lines for id_, code, line, pos in reversed(self.__stack): - res, msg, _ = self.__fixes[code](code, line, pos, apply=True) + res, msg, args, _ = self.__fixes[code](code, line, pos, apply=True) if res == 1: self.__modified = True self.fixed += 1 - results[id_] = (res, msg) + results[id_] = (res, msg, args) return results @@ -527,12 +526,16 @@ Codes: D111 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 quotes = re.match(r"""\s*[ru]?('''|'|\")""", @@ -547,7 +550,7 @@ line += 1 # Triple single quotes converted to triple double quotes. - return (1, "FIXD111", 0) + return (1, "FIXD111", [], 0) def __fixD112(self, code, line, pos): """ @@ -555,12 +558,16 @@ Codes: D112, D113 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 if code == "D112": @@ -577,7 +584,7 @@ ) self.__source[line] = newText # Introductory quotes corrected to be {0}""" - return (1, ('FIXD112', (insertChar,)), 0) + return (1, 'FIXD112', [insertChar], 0) def __fixD121(self, code, line, pos, apply=False): """ @@ -585,21 +592,25 @@ Codes: D121 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 if not self.__source[line].lstrip().startswith( ('"""', 'r"""', 'u"""')): # only correctly formatted docstrings will be fixed - return (0, "", 0) + return (0, "", [], 0) docstring = ( self.__source[line].rstrip() + @@ -614,11 +625,11 @@ self.__source[line] = docstring self.__source[line + 1] = "" # Single line docstring put on one line. - return (1, "FIXD121", 0) + return (1, "FIXD121", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD131(self, code, line, pos): """ @@ -627,12 +638,16 @@ Codes: D131 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 newText = "" @@ -660,9 +675,9 @@ if newText: self.__source[line] = newText # Period added to summary line. - return (1, "FIXD131", 0) + return (1, "FIXD131", [], 0) else: - return (0, "", 0) + return (0, "", [], 0) def __fixD141(self, code, line, pos, apply=False): """ @@ -671,24 +686,28 @@ Codes: D141 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 self.__source[line - 1] = "" # Blank line before function/method docstring removed. - return (1, "FIXD141", 0) + return (1, "FIXD141", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD142(self, code, line, pos, apply=False): """ @@ -697,24 +716,28 @@ Codes: D142 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 self.__source[line] = self.__eol + self.__source[line] # Blank line inserted before class docstring. - return (1, "FIXD142", 0) + return (1, "FIXD142", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD143(self, code, line, pos, apply=False): """ @@ -723,24 +746,28 @@ Codes: D143 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 self.__source[line] += self.__eol # Blank line inserted after class docstring. - return (1, "FIXD143", 0) + return (1, "FIXD143", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD144(self, code, line, pos, apply=False): """ @@ -749,14 +776,18 @@ Codes: D144 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -766,11 +797,11 @@ self.__source[line] += self.__eol # Blank line inserted after docstring summary. - return (1, "FIXD144", 0) + return (1, "FIXD144", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD145(self, code, line, pos, apply=False): """ @@ -779,24 +810,28 @@ Codes: D143 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 self.__source[line] = self.__eol + self.__source[line] # Blank line inserted after last paragraph of docstring. - return (1, "FIXD145", 0) + return (1, "FIXD145", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD221(self, code, line, pos, apply=False): """ @@ -805,14 +840,18 @@ Codes: D221, D222 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -842,11 +881,11 @@ else: # Trailing quotes put on separate line. msg = "FIXD222" - return (1, msg, 0) + return (1, msg, [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD242(self, code, line, pos, apply=False): """ @@ -855,14 +894,18 @@ Codes: D242, D244 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -873,11 +916,11 @@ else: # Blank line before function/method docstring removed. msg = "FIXD244" - return (1, msg, 0) + return (1, msg, [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD243(self, code, line, pos, apply=False): """ @@ -886,14 +929,18 @@ Codes: D243, D245 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -904,11 +951,11 @@ else: # Blank line after function/method docstring removed. msg = "FIXD245" - return (1, msg, 0) + return (1, msg, [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixD247(self, code, line, pos, apply=False): """ @@ -917,24 +964,28 @@ Codes: D247 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 self.__source[line - 1] = "" # Blank line after last paragraph removed. - return (1, "FIXD247", 0) + return (1, "FIXD247", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE101(self, code, line, pos): """ @@ -942,12 +993,16 @@ Codes: E101, E111, W191 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if self.__reindenter is None: self.__reindenter = Reindenter(self.__source) @@ -961,9 +1016,9 @@ else: # Indentation adjusted to be a multiple of four. msg = "FIXE111" - return (1, msg, 0) + return (1, msg, [], 0) else: - return (0, "", 0) + return (0, "", [], 0) def __fixE121(self, code, line, pos, apply=False): """ @@ -972,14 +1027,18 @@ Codes: E121, E124 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: logical = self.__getLogical(line, pos) @@ -993,12 +1052,12 @@ elif code == "E124": # Indentation of closing bracket corrected. msg = "FIXE124" - return (1, msg, 0) - return (0, "", 0) + return (1, msg, [], 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stackLogical.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE122(self, code, line, pos, apply=False): """ @@ -1006,14 +1065,18 @@ Codes: E122 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: logical = self.__getLogical(line, pos) @@ -1030,12 +1093,12 @@ self.__indentWord + text.lstrip() ) # Missing indentation of continuation line corrected. - return (1, "FIXE122", 0) - return (0, "", 0) + return (1, "FIXE122", [], 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stackLogical.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE123(self, code, line, pos, apply=False): """ @@ -1043,14 +1106,18 @@ Codes: E123 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: logical = self.__getLogical(line, pos) @@ -1068,12 +1135,12 @@ changed = True if changed: # Closing bracket aligned to opening bracket. - return (1, "FIXE123", 0) - return (0, "", 0) + return (1, "FIXE123", [], 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stackLogical.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE125(self, code, line, pos, apply=False): """ @@ -1082,14 +1149,18 @@ Codes: E125 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: logical = self.__getLogical(line, pos) @@ -1104,12 +1175,12 @@ self.__indentWord + text.lstrip() ) # Indentation level changed. - return (1, "FIXE125", 0) - return (0, "", 0) + return (1, "FIXE125", [], 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stackLogical.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE126(self, code, line, pos, apply=False): """ @@ -1118,14 +1189,18 @@ Codes: E126, E133 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: logical = self.__getLogical(line, pos) @@ -1146,12 +1221,12 @@ changed = True if changed: # Indentation level of hanging indentation changed. - return (1, "FIXE126", 0) - return (0, "", 0) + return (1, "FIXE126", [], 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stackLogical.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE127(self, code, line, pos, apply=False): """ @@ -1159,14 +1234,18 @@ Codes: E127, E128 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: logical = self.__getLogical(line, pos) @@ -1204,12 +1283,12 @@ changed = True if changed: # Visual indentation corrected. - return (1, "FIXE127", 0) - return (0, "", 0) + return (1, "FIXE127", [], 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stackLogical.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE201(self, code, line, pos): """ @@ -1217,26 +1296,30 @@ Codes: E201, E202, E203, E211 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 text = self.__source[line] if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): - return (0, "", 0) + return (0, "", [], 0) newText = self.__fixWhitespace(text, pos, '') if newText == text: - return (0, "", 0) + return (0, "", [], 0) self.__source[line] = newText # Extraneous whitespace removed. - return (1, "FIXE201", 0) + return (1, "FIXE201", [], 0) def __fixE221(self, code, line, pos): """ @@ -1245,25 +1328,29 @@ Codes: E221, E222, E223, E224, E241, E242, E271, E272, E273, E274 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 text = self.__source[line] if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): - return (0, "", 0) + return (0, "", [], 0) newText = self.__fixWhitespace(text, pos, ' ') if newText == text: - return (0, "", 0) + return (0, "", [], 0) self.__source[line] = newText - return (1, "FIXE221", 0) + return (1, "FIXE221", [], 0) def __fixE225(self, code, line, pos): """ @@ -1271,18 +1358,22 @@ Codes: E225, E226, E227, E228 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 text = self.__source[line] if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): - return (0, "", 0) + return (0, "", [], 0) newText = text # determine length of operator @@ -1300,11 +1391,11 @@ newText = self.__fixWhitespace(newText, pos2, ' ') newText = self.__fixWhitespace(newText, pos, ' ') if newText == text: - return (0, "", 0) + return (0, "", [], 0) self.__source[line] = newText # Missing whitespaces added. - return (1, "FIXE225", 0) + return (1, "FIXE225", [], 0) def __fixE231(self, code, line, pos): """ @@ -1312,12 +1403,16 @@ Codes: E231 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 pos = pos + 1 @@ -1327,7 +1422,7 @@ self.__source[line][pos:] ) # Missing whitespace added. - return (1, "FIXE231", 0) + return (1, "FIXE231", [], 0) def __fixE251(self, code, line, pos): """ @@ -1336,12 +1431,16 @@ Codes: E251 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 text = self.__source[line] @@ -1362,7 +1461,7 @@ else: self.__source[line] = newText # Extraneous whitespace removed. - return (1, "FIXE251", 0) + return (1, "FIXE251", [], 0) def __fixE261(self, code, line, pos): """ @@ -1370,12 +1469,16 @@ Codes: E261, E262 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 text = self.__source[line] @@ -1384,7 +1487,7 @@ newText = left + (" # " + right if right.strip() else right) self.__source[line] = newText # Whitespace around comment sign corrected. - return (1, "FIXE261", 0) + return (1, "FIXE261", [], 0) def __fixBlankLinesBefore(self, code, line, pos, apply=False): """ @@ -1393,14 +1496,18 @@ Codes: E301, E302, E303, E305, E306, E307, E308 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: if code in ["E301", "E306", "E307"]: @@ -1428,7 +1535,7 @@ self.__source.insert(line, self.__eol) delta += 1 # %n blank line(s) inserted. - return (1, ("FIXE302+", blankLinesBefore - blanks), 0) + return (1, "FIXE302+", blankLinesBefore - blanks, 0) elif delta > 0: # delete superfluous blank lines while delta > 0: @@ -1436,13 +1543,13 @@ line -= 1 delta -= 1 # %n superfluous line(s) removed. - return (1, ("FIXE302-", blanks - blankLinesBefore), 0) + return (1, "FIXE302-", blanks - blankLinesBefore, 0) else: - return (0, "", 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE304(self, code, line, pos, apply=False): """ @@ -1451,14 +1558,18 @@ Codes: E304 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: index = line - 2 @@ -1469,11 +1580,11 @@ else: break # Superfluous blank lines after function decorator removed. - return (1, "FIXE304", 0) + return (1, "FIXE304", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE401(self, code, line, pos, apply=False): """ @@ -1481,26 +1592,30 @@ Codes: E401 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 text = self.__source[line] if not text.lstrip().startswith("import"): - return (0, "", 0) + return (0, "", [], 0) # pycodestyle (1.3.1) reports false positive if there is an import # statement followed by a semicolon and some unrelated # statement with commas in it. if ';' in text: - return (0, "", 0) + return (0, "", [], 0) newText = ( text[:pos].rstrip("\t ,") + @@ -1511,11 +1626,11 @@ ) self.__source[line] = newText # Imports were put on separate lines. - return (1, "FIXE401", 0) + return (1, "FIXE401", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE501(self, code, line, pos, apply=False): """ @@ -1523,14 +1638,18 @@ Codes: E501 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: multilineStringLines, docStringLines = ( @@ -1560,13 +1679,13 @@ newNextText = "" self.__source[line + 1] = newNextText # Long lines have been shortened. - return (1, "FIXE501", 0) + return (1, "FIXE501", [], 0) else: - return (0, "", 0) + return (0, "", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE502(self, code, line, pos): """ @@ -1574,19 +1693,23 @@ Codes: E502 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ self.__source[line - 1] = ( self.__source[line - 1].rstrip("\n\r \t\\") + self.__eol ) # Redundant backslash in brackets removed. - return (1, "FIXE502", 0) + return (1, "FIXE502", [], 0) def __fixE701(self, code, line, pos, apply=False): """ @@ -1594,14 +1717,18 @@ Codes: E701 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -1618,11 +1745,11 @@ ) self.__source[line] = newText # Compound statement corrected. - return (1, "FIXE701", 0) + return (1, "FIXE701", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE702(self, code, line, pos, apply=False): """ @@ -1630,14 +1757,18 @@ Codes: E702, E703 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -1654,11 +1785,11 @@ second = text[pos:].lstrip("\n\r \t;") self.__source[line] = first + self.__getIndent(text) + second # Compound statement corrected. - return (1, "FIXE702", 0) + return (1, "FIXE702", [], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixE711(self, code, line, pos): """ @@ -1666,12 +1797,16 @@ Codes: E711, E712 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ line = line - 1 text = self.__source[line] @@ -1685,18 +1820,18 @@ right = text[rightPos:].lstrip() if not right.startswith(("None", "True", "False")): - return (0, "", 0) + return (0, "", [], 0) if center.strip() == "==": center = "is" elif center.strip() == "!=": center = "is not" else: - return (0, "", 0) + return (0, "", [], 0) self.__source[line] = " ".join([left, center, right]) # Comparison to None/True/False corrected. - return (1, "FIXE711", 0) + return (1, "FIXE711", [], 0) def __fixN804(self, code, line, pos, apply=False): """ @@ -1705,14 +1840,18 @@ Codes: N804, N805 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -1742,11 +1881,11 @@ newText = left + center + right self.__source[line] = newText # '{0}' argument added. - return (1, ("FIXN804", (arg,)), 0) + return (1, "FIXN804", [arg], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixN806(self, code, line, pos, apply=False): """ @@ -1754,14 +1893,18 @@ Codes: N806 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int + @param apply flag indicating, that the fix should be applied + @type bool @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ if apply: line = line - 1 @@ -1804,11 +1947,11 @@ self.__source[line] = indent + right # '{0}' argument removed. - return (1, ("FIXN806", arg), 0) + return (1, "FIXN806", [arg], 0) else: fixId = self.__getID() self.__stack.append((fixId, code, line, pos)) - return (-1, "", fixId) + return (-1, "", [], fixId) def __fixW291(self, code, line, pos): """ @@ -1816,17 +1959,21 @@ Codes: W291, W293 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ self.__source[line - 1] = re.sub(r'[\t ]+(\r?)$', r"\1", self.__source[line - 1]) # Whitespace stripped from end of line. - return (1, "FIXW291", 0) + return (1, "FIXW291", [], 0) def __fixW292(self, code, line, pos): """ @@ -1834,16 +1981,20 @@ Codes: W292 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ self.__source[line - 1] += self.__eol # newline added to end of file. - return (1, "FIXW292", 0) + return (1, "FIXW292", [], 0) def __fixW391(self, code, line, pos): """ @@ -1851,12 +2002,16 @@ Codes: W391 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ index = line - 1 while index: @@ -1866,7 +2021,7 @@ else: break # Superfluous trailing blank lines removed from end of file. - return (1, "FIXW391", 0) + return (1, "FIXW391", [], 0) def __fixW603(self, code, line, pos): """ @@ -1874,16 +2029,20 @@ Codes: W603 - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) + @param code code of the issue + @type str + @param line line number of the issue + @type int + @param pos position inside line + @type int @return value indicating an applied/deferred fix (-1, 0, 1), - a message for the fix (string) and an ID for a deferred - fix (integer) + a message code for the fix, a list of arguments for the + message and an ID for a deferred fix + @rtype tuple of (int, str, list or int, int) """ self.__source[line - 1] = self.__source[line - 1].replace("<>", "!=") # '<>' replaced by '!='. - return (1, "FIXW603", 0) + return (1, "FIXW603", [], 0) class Reindenter(object):
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/ComplexityChecker.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/ComplexityChecker.py Sat Jun 06 19:42:15 2020 +0200 @@ -104,7 +104,14 @@ if code: # record the issue with one based line number self.errors.append( - (self.__filename, lineNumber, offset, (code, args))) + { + "file": self.__filename, + "line": lineNumber, + "offset": offset, + "code": code, + "args": args, + } + ) def __reportInvalidSyntax(self): """
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py Sat Jun 06 19:42:15 2020 +0200 @@ -308,7 +308,14 @@ if code and (self.counters[code] == 1 or self.__repeat): # record the issue with one based line number self.errors.append( - (self.__filename, lineNumber + 1, offset, (code, args))) + { + "file": self.__filename, + "line": lineNumber + 1, + "offset": offset, + "code": code, + "args": args, + } + ) def __reportInvalidSyntax(self): """
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Sat Jun 06 19:42:15 2020 +0200 @@ -261,7 +261,14 @@ if code and (self.counters[code] == 1 or self.__repeat): # record the issue with one based line number self.errors.append( - (self.__filename, lineNumber + 1, offset, (code, args))) + { + "file": self.__filename, + "line": lineNumber + 1, + "offset": offset, + "code": code, + "args": args, + } + ) def __reportInvalidSyntax(self): """
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py Sat Jun 06 19:42:15 2020 +0200 @@ -1078,38 +1078,29 @@ } -def getTranslatedMessage(message): +def getTranslatedMessage(messageCode, messageArgs): """ Module function to get a translated and formatted message for a given message ID. - @param message the message ID + @param messageCode the message code @type str + @param messageArgs list of arguments or a single integer value to format + the message + @type list or int @return translated and formatted message @rtype str """ - if isinstance(message, list): - message, args = message - else: - args = [] - - if message in _messages: - if isinstance(args, int): + if messageCode in _messages: + if isinstance(messageArgs, int): # Retranslate with correct plural form - return _messages[message](args) + return _messages[messageCode](messageArgs) else: - if message.startswith(('FIXD', 'FIXE', 'FIXN', 'FIXW')): - prefix = '' - else: - prefix = message + ' ' - return prefix + _messages[message].format(*args) - elif ' ' in message: - # already translated - return message + return _messages[messageCode].format(*messageArgs) else: return QCoreApplication.translate( "CodeStyleFixer", " no message defined for code '{0}'" - ).format(message) + ).format(messageCode) # # eflag: noqa = M201
--- a/eric6/Plugins/PluginCodeStyleChecker.py Thu Jun 04 17:57:20 2020 +0200 +++ b/eric6/Plugins/PluginCodeStyleChecker.py Sat Jun 06 19:42:15 2020 +0200 @@ -222,11 +222,13 @@ """ Private slot called after perfoming a style check on one file. - @param fn filename of the just checked file (str) - @param codeStyleCheckerStats stats of style and name check (dict) - @param results tuple for each found violation of style (tuple of - lineno (int), position (int), text (str), fixed (bool), - autofixing (bool), fixedMsg (str)) + @param fn filename of the just checked file + @type str + @param codeStyleCheckerStats stats of style and name check + @type dict + @param results dictionary containing the check result data + (see CodesStyleChecker.__checkCodeStyle for details) + @type dict """ from CheckerPlugins.CodeStyleChecker.translations import ( getTranslatedMessage @@ -234,17 +236,17 @@ fixes = 0 for result in results: - msg = getTranslatedMessage(result[2]) + msg = getTranslatedMessage(result["code"], result["args"]) - fixedMsg = result.pop() - if fixedMsg: + if result["fixcode"]: fixes += 1 - trFixedMsg = getTranslatedMessage(fixedMsg) + trFixedMsg = getTranslatedMessage(result["fixcode"], + result["fixargs"]) msg += "\n" + QCoreApplication.translate( 'CodeStyleCheckerDialog', "Fix: {0}").format(trFixedMsg) - result[2] = msg + result["display"] = msg self.styleChecked.emit(fn, codeStyleCheckerStats, fixes, results) def activate(self):