Continued implementing a fixer for PEP 8 issues.

Mon, 17 Jan 2011 20:15:54 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 17 Jan 2011 20:15:54 +0100
changeset 853
ec7dd115e26b
parent 852
257a6f80b96c
child 854
2f4ffd2c7d02

Continued implementing a fixer for PEP 8 issues.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html file | annotate | diff | comparison | revisions
Documentation/Source/index-eric5.Plugins.CheckerPlugins.Pep8.html file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/Pep8/Pep8Dialog.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/Pep8/Pep8Fixer.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/Pep8/Pep8StatisticsDialog.py file | annotate | diff | comparison | revisions
icons/default/issueFixable.png file | annotate | diff | comparison | revisions
icons/default/issueFixed.png file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Mon Jan 17 11:51:33 2011 +0100
+++ b/APIs/Python3/eric5.api	Mon Jan 17 20:15:54 2011 +0100
@@ -2625,12 +2625,13 @@
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Checker.Pep8Checker?1(filename, lines, repeat=False, select="", ignore="")
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Checker.Pep8Py2Checker?1(filename, lines, repeat=False, select="", ignore="")
 eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.Pep8CodeSelectionDialog.getSelectedCodes?4()
-eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.Pep8CodeSelectionDialog?1(codes, parent = None)
+eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.Pep8CodeSelectionDialog?1(codes, showFixCodes, parent = None)
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.filenameRole?7
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.lineRole?7
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.messageRole?7
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.on_buttonBox_clicked?4(button)
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.on_excludeMessagesSelectButton_clicked?4()
+eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.on_fixIssuesSelectButton_clicked?4()
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.on_includeMessagesSelectButton_clicked?4()
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.on_loadDefaultButton_clicked?4()
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.on_resultList_itemActivated?4(item, column)
@@ -2641,8 +2642,12 @@
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.positionRole?7
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.prepare?4(fileList, project)
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.settingsKey?7
-eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.start?4(fn, codestring = "", save = False, repeat = None)
+eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog.start?4(fn, save = False, repeat = None)
 eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.Pep8Dialog?1(parent = None)
+eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8FixableIssues?7
+eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Fixer.fixIssue?4(line, pos, message)
+eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Fixer.saveFile?4(encoding)
+eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Fixer?1(project, filename, sourceLines, fixCodes, inPlace)
 eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.Pep8StatisticsDialog?1(statistics, parent = None)
 eric5.Plugins.CheckerPlugins.Pep8.pep8.BENCHMARK_KEYS?7
 eric5.Plugins.CheckerPlugins.Pep8.pep8.BINARY_OPERATORS?7
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Mon Jan 17 11:51:33 2011 +0100
+++ b/Documentation/Help/source.qhp	Mon Jan 17 20:15:54 2011 +0100
@@ -334,6 +334,7 @@
                 <section title="eric5.Plugins.CheckerPlugins.Pep8.Pep8Checker" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Checker.html" />
                 <section title="eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.html" />
                 <section title="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html" />
+                <section title="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html" />
                 <section title="eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.html" />
                 <section title="eric5.Plugins.CheckerPlugins.Pep8.pep8" ref="eric5.Plugins.CheckerPlugins.Pep8.pep8.html" />
               </section>
@@ -9402,6 +9403,7 @@
       <keyword name="Pep8Dialog.__updateStatistics" id="Pep8Dialog.__updateStatistics" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Dialog.__updateStatistics" />
       <keyword name="Pep8Dialog.on_buttonBox_clicked" id="Pep8Dialog.on_buttonBox_clicked" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Dialog.on_buttonBox_clicked" />
       <keyword name="Pep8Dialog.on_excludeMessagesSelectButton_clicked" id="Pep8Dialog.on_excludeMessagesSelectButton_clicked" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Dialog.on_excludeMessagesSelectButton_clicked" />
+      <keyword name="Pep8Dialog.on_fixIssuesSelectButton_clicked" id="Pep8Dialog.on_fixIssuesSelectButton_clicked" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Dialog.on_fixIssuesSelectButton_clicked" />
       <keyword name="Pep8Dialog.on_includeMessagesSelectButton_clicked" id="Pep8Dialog.on_includeMessagesSelectButton_clicked" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Dialog.on_includeMessagesSelectButton_clicked" />
       <keyword name="Pep8Dialog.on_loadDefaultButton_clicked" id="Pep8Dialog.on_loadDefaultButton_clicked" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Dialog.on_loadDefaultButton_clicked" />
       <keyword name="Pep8Dialog.on_resultList_itemActivated" id="Pep8Dialog.on_resultList_itemActivated" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Dialog.on_resultList_itemActivated" />
@@ -9415,6 +9417,30 @@
       <keyword name="Pep8StatisticsDialog" id="Pep8StatisticsDialog" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.html#Pep8StatisticsDialog" />
       <keyword name="Pep8StatisticsDialog (Constructor)" id="Pep8StatisticsDialog (Constructor)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.html#Pep8StatisticsDialog.__init__" />
       <keyword name="Pep8StatisticsDialog.__createItem" id="Pep8StatisticsDialog.__createItem" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.html#Pep8StatisticsDialog.__createItem" />
+      <keyword name="Pep8Fixer (Module)" id="Pep8Fixer (Module)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html" />
+      <keyword name="Pep8Fixer" id="Pep8Fixer" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer" />
+      <keyword name="Pep8Fixer (Constructor)" id="Pep8Fixer (Constructor)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__init__" />
+      <keyword name="Pep8Fixer.__finalize" id="Pep8Fixer.__finalize" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__finalize" />
+      <keyword name="Pep8Fixer.__fixBlankLinesAfterDecorator" id="Pep8Fixer.__fixBlankLinesAfterDecorator" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixBlankLinesAfterDecorator" />
+      <keyword name="Pep8Fixer.__fixMissingWhitespaceAfter" id="Pep8Fixer.__fixMissingWhitespaceAfter" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixMissingWhitespaceAfter" />
+      <keyword name="Pep8Fixer.__fixMissingWhitespaceAroundOperator" id="Pep8Fixer.__fixMissingWhitespaceAroundOperator" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixMissingWhitespaceAroundOperator" />
+      <keyword name="Pep8Fixer.__fixNewline" id="Pep8Fixer.__fixNewline" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixNewline" />
+      <keyword name="Pep8Fixer.__fixNotEqual" id="Pep8Fixer.__fixNotEqual" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixNotEqual" />
+      <keyword name="Pep8Fixer.__fixOneBlankLine" id="Pep8Fixer.__fixOneBlankLine" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixOneBlankLine" />
+      <keyword name="Pep8Fixer.__fixTabs" id="Pep8Fixer.__fixTabs" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTabs" />
+      <keyword name="Pep8Fixer.__fixTooManyBlankLines" id="Pep8Fixer.__fixTooManyBlankLines" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTooManyBlankLines" />
+      <keyword name="Pep8Fixer.__fixTrailingBlankLines" id="Pep8Fixer.__fixTrailingBlankLines" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTrailingBlankLines" />
+      <keyword name="Pep8Fixer.__fixTwoBlankLines" id="Pep8Fixer.__fixTwoBlankLines" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTwoBlankLines" />
+      <keyword name="Pep8Fixer.__fixWhitespace" id="Pep8Fixer.__fixWhitespace" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespace" />
+      <keyword name="Pep8Fixer.__fixWhitespaceAfter" id="Pep8Fixer.__fixWhitespaceAfter" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAfter" />
+      <keyword name="Pep8Fixer.__fixWhitespaceAfterInline" id="Pep8Fixer.__fixWhitespaceAfterInline" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAfterInline" />
+      <keyword name="Pep8Fixer.__fixWhitespaceAroundEquals" id="Pep8Fixer.__fixWhitespaceAroundEquals" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAroundEquals" />
+      <keyword name="Pep8Fixer.__fixWhitespaceAroundOperator" id="Pep8Fixer.__fixWhitespaceAroundOperator" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAroundOperator" />
+      <keyword name="Pep8Fixer.__fixWhitespaceBefore" id="Pep8Fixer.__fixWhitespaceBefore" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceBefore" />
+      <keyword name="Pep8Fixer.__fixWhitespaceBeforeInline" id="Pep8Fixer.__fixWhitespaceBeforeInline" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceBeforeInline" />
+      <keyword name="Pep8Fixer.__getEol" id="Pep8Fixer.__getEol" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__getEol" />
+      <keyword name="Pep8Fixer.fixIssue" id="Pep8Fixer.fixIssue" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.fixIssue" />
+      <keyword name="Pep8Fixer.saveFile" id="Pep8Fixer.saveFile" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.saveFile" />
       <keyword name="Tabnanny (Package)" id="Tabnanny (Package)" ref="index-eric5.Plugins.CheckerPlugins.Tabnanny.html" />
       <keyword name="TabnannyDialog (Module)" id="TabnannyDialog (Module)" ref="eric5.Plugins.CheckerPlugins.Tabnanny.TabnannyDialog.html" />
       <keyword name="TabnannyDialog" id="TabnannyDialog" ref="eric5.Plugins.CheckerPlugins.Tabnanny.TabnannyDialog.html#TabnannyDialog" />
@@ -10421,6 +10447,7 @@
       <file>eric5.Plugins.CheckerPlugins.Pep8.Pep8Checker.html</file>
       <file>eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.html</file>
       <file>eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html</file>
+      <file>eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html</file>
       <file>eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.html</file>
       <file>eric5.Plugins.CheckerPlugins.Pep8.pep8.html</file>
       <file>eric5.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog.html</file>
--- a/Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.html	Mon Jan 17 11:51:33 2011 +0100
+++ b/Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8CodeSelectionDialog.html	Mon Jan 17 20:15:54 2011 +0100
@@ -63,13 +63,17 @@
 </table>
 <a NAME="Pep8CodeSelectionDialog.__init__" ID="Pep8CodeSelectionDialog.__init__"></a>
 <h4>Pep8CodeSelectionDialog (Constructor)</h4>
-<b>Pep8CodeSelectionDialog</b>(<i>codes, parent = None</i>)
+<b>Pep8CodeSelectionDialog</b>(<i>codes, showFixCodes, parent = None</i>)
 <p>
         Constructor
 </p><dl>
 <dt><i>codes</i></dt>
 <dd>
 comma separated list of selected codes (string)
+</dd><dt><i>showFixCodes</i></dt>
+<dd>
+flag indicating to show a list of fixable
+            issues (boolean)
 </dd><dt><i>parent</i></dt>
 <dd>
 reference to the parent widget (QWidget)
--- a/Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html	Mon Jan 17 11:51:33 2011 +0100
+++ b/Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html	Mon Jan 17 20:15:54 2011 +0100
@@ -81,6 +81,9 @@
 <td><a href="#Pep8Dialog.on_excludeMessagesSelectButton_clicked">on_excludeMessagesSelectButton_clicked</a></td>
 <td>Private slot to select the message codes to be excluded via a selection dialog.</td>
 </tr><tr>
+<td><a href="#Pep8Dialog.on_fixIssuesSelectButton_clicked">on_fixIssuesSelectButton_clicked</a></td>
+<td>Private slot to select the issue codes to be fixed via a selection dialog.</td>
+</tr><tr>
 <td><a href="#Pep8Dialog.on_includeMessagesSelectButton_clicked">on_includeMessagesSelectButton_clicked</a></td>
 <td>Private slot to select the message codes to be included via a selection dialog.</td>
 </tr><tr>
@@ -126,7 +129,7 @@
         Private method to clear all warning markers of open editors.
 </p><a NAME="Pep8Dialog.__createResultItem" ID="Pep8Dialog.__createResultItem"></a>
 <h4>Pep8Dialog.__createResultItem</h4>
-<b>__createResultItem</b>(<i>file, line, pos, message</i>)
+<b>__createResultItem</b>(<i>file, line, pos, message, fixed</i>)
 <p>
         Private method to create an entry in the result list.
 </p><dl>
@@ -142,6 +145,9 @@
 </dd><dt><i>message</i></dt>
 <dd>
 message text (string)
+</dd><dt><i>fixed</i></dt>
+<dd>
+flag indicating a fixed issue (boolean)
 </dd>
 </dl><a NAME="Pep8Dialog.__finish" ID="Pep8Dialog.__finish"></a>
 <h4>Pep8Dialog.__finish</h4>
@@ -186,6 +192,12 @@
 <p>
         Private slot to select the message codes to be excluded via a
         selection dialog.
+</p><a NAME="Pep8Dialog.on_fixIssuesSelectButton_clicked" ID="Pep8Dialog.on_fixIssuesSelectButton_clicked"></a>
+<h4>Pep8Dialog.on_fixIssuesSelectButton_clicked</h4>
+<b>on_fixIssuesSelectButton_clicked</b>(<i></i>)
+<p>
+        Private slot to select the issue codes to be fixed via a
+        selection dialog.
 </p><a NAME="Pep8Dialog.on_includeMessagesSelectButton_clicked" ID="Pep8Dialog.on_includeMessagesSelectButton_clicked"></a>
 <h4>Pep8Dialog.on_includeMessagesSelectButton_clicked</h4>
 <b>on_includeMessagesSelectButton_clicked</b>(<i></i>)
@@ -246,7 +258,7 @@
 </dd>
 </dl><a NAME="Pep8Dialog.start" ID="Pep8Dialog.start"></a>
 <h4>Pep8Dialog.start</h4>
-<b>start</b>(<i>fn, codestring = "", save = False, repeat = None</i>)
+<b>start</b>(<i>fn, save = False, repeat = None</i>)
 <p>
         Public slot to start the PEP 8 check.
 </p><dl>
@@ -254,10 +266,6 @@
 <dd>
 file or list of files or directory to be checked
                 (string or list of strings)
-</dd><dt><i>codestring=</i></dt>
-<dd>
-string containing the code to be checked (string).
-            If this is given, file must be a single file name.
 </dd><dt><i>save=</i></dt>
 <dd>
 flag indicating to save the given
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html	Mon Jan 17 20:15:54 2011 +0100
@@ -0,0 +1,607 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
+'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
+<html><head>
+<title>eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer</title>
+<style>
+body {
+    background: #EDECE6;
+    margin: 0em 1em 10em 1em;
+    color: black;
+}
+
+h1 { color: white; background: #85774A; }
+h2 { color: white; background: #85774A; }
+h3 { color: white; background: #9D936E; }
+h4 { color: white; background: #9D936E; }
+    
+a { color: #BA6D36; }
+
+</style>
+</head>
+<body><a NAME="top" ID="top"></a>
+<h1>eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer</h1>
+<p>
+Module implementing a class to fix certain PEP 8 issues.
+</p>
+<h3>Global Attributes</h3>
+<table>
+<tr><td>Pep8FixableIssues</td></tr>
+</table>
+<h3>Classes</h3>
+<table>
+<tr>
+<td><a href="#Pep8Fixer">Pep8Fixer</a></td>
+<td>Class implementing a fixer for certain PEP 8 issues.</td>
+</tr>
+</table>
+<h3>Functions</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<hr /><hr />
+<a NAME="Pep8Fixer" ID="Pep8Fixer"></a>
+<h2>Pep8Fixer</h2>
+<p>
+    Class implementing a fixer for certain PEP 8 issues.
+</p>
+<h3>Derived from</h3>
+QObject
+<h3>Class Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Methods</h3>
+<table>
+<tr>
+<td><a href="#Pep8Fixer.__init__">Pep8Fixer</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__finalize">__finalize</a></td>
+<td>Private method to apply all deferred fixes.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixBlankLinesAfterDecorator">__fixBlankLinesAfterDecorator</a></td>
+<td>Private method to fix superfluous blank lines after a function decorator.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixMissingWhitespaceAfter">__fixMissingWhitespaceAfter</a></td>
+<td>Private method to fix missing whitespace after ',;:'.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixMissingWhitespaceAroundOperator">__fixMissingWhitespaceAroundOperator</a></td>
+<td>Private method to fix missing whitespace after ',;:'.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixNewline">__fixNewline</a></td>
+<td>Private method to fix a missing newline at the end of file.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixNotEqual">__fixNotEqual</a></td>
+<td>Private method to fix the not equal notation.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixOneBlankLine">__fixOneBlankLine</a></td>
+<td>Private method to fix the need for one blank line.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixTabs">__fixTabs</a></td>
+<td>Private method to fix obsolete tab usage.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixTooManyBlankLines">__fixTooManyBlankLines</a></td>
+<td>Private method to fix superfluous blank lines.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixTrailingBlankLines">__fixTrailingBlankLines</a></td>
+<td>Private method to fix trailing blank lines.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixTwoBlankLines">__fixTwoBlankLines</a></td>
+<td>Private method to fix the need for two blank lines.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixWhitespace">__fixWhitespace</a></td>
+<td>Private method to fix trailing whitespace.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixWhitespaceAfter">__fixWhitespaceAfter</a></td>
+<td>Private method to fix superfluous whitespace after '([{'.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixWhitespaceAfterInline">__fixWhitespaceAfterInline</a></td>
+<td>Private method to fix whitespace after inline comment.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixWhitespaceAroundEquals">__fixWhitespaceAroundEquals</a></td>
+<td>Private method to fix extraneous whitespace around keyword and default parameter equals.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixWhitespaceAroundOperator">__fixWhitespaceAroundOperator</a></td>
+<td>Private method to fix extraneous whitespace around operator.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixWhitespaceBefore">__fixWhitespaceBefore</a></td>
+<td>Private method to fix superfluous whitespace before '}])', ',;:' and '(['.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__fixWhitespaceBeforeInline">__fixWhitespaceBeforeInline</a></td>
+<td>Private method to fix missing whitespace before inline comment.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.__getEol">__getEol</a></td>
+<td>Private method to get the applicable eol string.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.fixIssue">fixIssue</a></td>
+<td>Public method to fix the fixable issues.</td>
+</tr><tr>
+<td><a href="#Pep8Fixer.saveFile">saveFile</a></td>
+<td>Public method to save the modified file.</td>
+</tr>
+</table>
+<a NAME="Pep8Fixer.__init__" ID="Pep8Fixer.__init__"></a>
+<h4>Pep8Fixer (Constructor)</h4>
+<b>Pep8Fixer</b>(<i>project, filename, sourceLines, fixCodes, inPlace</i>)
+<p>
+        Constructor
+</p><dl>
+<dt><i>project</i></dt>
+<dd>
+reference to the project object (Project)
+</dd><dt><i>filename</i></dt>
+<dd>
+name of the file to be fixed (string)
+</dd><dt><i>sourceLines</i></dt>
+<dd>
+list of source lines including eol marker
+            (list of string)
+</dd><dt><i>fixCodes</i></dt>
+<dd>
+list of codes to be fixed as a comma separated
+            string (string)
+</dd><dt><i>inPlace</i></dt>
+<dd>
+flag indicating to modify the file in place (boolean)
+</dd>
+</dl><a NAME="Pep8Fixer.__finalize" ID="Pep8Fixer.__finalize"></a>
+<h4>Pep8Fixer.__finalize</h4>
+<b>__finalize</b>(<i></i>)
+<p>
+        Private method to apply all deferred fixes.
+</p><a NAME="Pep8Fixer.__fixBlankLinesAfterDecorator" ID="Pep8Fixer.__fixBlankLinesAfterDecorator"></a>
+<h4>Pep8Fixer.__fixBlankLinesAfterDecorator</h4>
+<b>__fixBlankLinesAfterDecorator</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix superfluous blank lines after a function
+        decorator.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixMissingWhitespaceAfter" ID="Pep8Fixer.__fixMissingWhitespaceAfter"></a>
+<h4>Pep8Fixer.__fixMissingWhitespaceAfter</h4>
+<b>__fixMissingWhitespaceAfter</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix missing whitespace after ',;:'.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixMissingWhitespaceAroundOperator" ID="Pep8Fixer.__fixMissingWhitespaceAroundOperator"></a>
+<h4>Pep8Fixer.__fixMissingWhitespaceAroundOperator</h4>
+<b>__fixMissingWhitespaceAroundOperator</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix missing whitespace after ',;:'.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixNewline" ID="Pep8Fixer.__fixNewline"></a>
+<h4>Pep8Fixer.__fixNewline</h4>
+<b>__fixNewline</b>(<i>code, line, pos</i>)
+<p>
+        Private method to fix a missing newline at the end of file.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixNotEqual" ID="Pep8Fixer.__fixNotEqual"></a>
+<h4>Pep8Fixer.__fixNotEqual</h4>
+<b>__fixNotEqual</b>(<i>code, line, pos</i>)
+<p>
+        Private method to fix the not equal notation.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixOneBlankLine" ID="Pep8Fixer.__fixOneBlankLine"></a>
+<h4>Pep8Fixer.__fixOneBlankLine</h4>
+<b>__fixOneBlankLine</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix the need for one blank line.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixTabs" ID="Pep8Fixer.__fixTabs"></a>
+<h4>Pep8Fixer.__fixTabs</h4>
+<b>__fixTabs</b>(<i>code, line, pos</i>)
+<p>
+        Private method to fix obsolete tab usage.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixTooManyBlankLines" ID="Pep8Fixer.__fixTooManyBlankLines"></a>
+<h4>Pep8Fixer.__fixTooManyBlankLines</h4>
+<b>__fixTooManyBlankLines</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix superfluous blank lines.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixTrailingBlankLines" ID="Pep8Fixer.__fixTrailingBlankLines"></a>
+<h4>Pep8Fixer.__fixTrailingBlankLines</h4>
+<b>__fixTrailingBlankLines</b>(<i>code, line, pos</i>)
+<p>
+        Private method to fix trailing blank lines.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixTwoBlankLines" ID="Pep8Fixer.__fixTwoBlankLines"></a>
+<h4>Pep8Fixer.__fixTwoBlankLines</h4>
+<b>__fixTwoBlankLines</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix the need for two blank lines.
+</p><a NAME="Pep8Fixer.__fixWhitespace" ID="Pep8Fixer.__fixWhitespace"></a>
+<h4>Pep8Fixer.__fixWhitespace</h4>
+<b>__fixWhitespace</b>(<i>code, line, pos</i>)
+<p>
+        Private method to fix trailing whitespace.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixWhitespaceAfter" ID="Pep8Fixer.__fixWhitespaceAfter"></a>
+<h4>Pep8Fixer.__fixWhitespaceAfter</h4>
+<b>__fixWhitespaceAfter</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix superfluous whitespace after '([{'.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixWhitespaceAfterInline" ID="Pep8Fixer.__fixWhitespaceAfterInline"></a>
+<h4>Pep8Fixer.__fixWhitespaceAfterInline</h4>
+<b>__fixWhitespaceAfterInline</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix whitespace after inline comment.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixWhitespaceAroundEquals" ID="Pep8Fixer.__fixWhitespaceAroundEquals"></a>
+<h4>Pep8Fixer.__fixWhitespaceAroundEquals</h4>
+<b>__fixWhitespaceAroundEquals</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix extraneous whitespace around keyword and
+        default parameter equals.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixWhitespaceAroundOperator" ID="Pep8Fixer.__fixWhitespaceAroundOperator"></a>
+<h4>Pep8Fixer.__fixWhitespaceAroundOperator</h4>
+<b>__fixWhitespaceAroundOperator</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix extraneous whitespace around operator.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixWhitespaceBefore" ID="Pep8Fixer.__fixWhitespaceBefore"></a>
+<h4>Pep8Fixer.__fixWhitespaceBefore</h4>
+<b>__fixWhitespaceBefore</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix superfluous whitespace before '}])',
+        ',;:' and '(['.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__fixWhitespaceBeforeInline" ID="Pep8Fixer.__fixWhitespaceBeforeInline"></a>
+<h4>Pep8Fixer.__fixWhitespaceBeforeInline</h4>
+<b>__fixWhitespaceBeforeInline</b>(<i>code, line, pos, apply=False</i>)
+<p>
+        Private method to fix missing whitespace before inline comment.
+</p><dl>
+<dt><i>code</i></dt>
+<dd>
+code of the issue (string)
+</dd><dt><i>line</i></dt>
+<dd>
+line number of the issue (integer)
+</dd><dt><i>pos</i></dt>
+<dd>
+position inside line (integer)
+</dd><dt><i>apply=</i></dt>
+<dd>
+flag indicating, that the fix should be applied
+            (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.__getEol" ID="Pep8Fixer.__getEol"></a>
+<h4>Pep8Fixer.__getEol</h4>
+<b>__getEol</b>(<i></i>)
+<p>
+        Private method to get the applicable eol string.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+eol string (string)
+</dd>
+</dl><a NAME="Pep8Fixer.fixIssue" ID="Pep8Fixer.fixIssue"></a>
+<h4>Pep8Fixer.fixIssue</h4>
+<b>fixIssue</b>(<i>line, pos, message</i>)
+<p>
+        Public method to fix the fixable issues.
+</p><dl>
+<dt><i>line</i></dt>
+<dd>
+line number of issue (integer or string)
+</dd><dt><i>pos</i></dt>
+<dd>
+character position of issue (integer or string)
+</dd><dt><i>message</i></dt>
+<dd>
+message text (string)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating an applied fix (boolean) and a message for
+            the fix (string)
+</dd>
+</dl><a NAME="Pep8Fixer.saveFile" ID="Pep8Fixer.saveFile"></a>
+<h4>Pep8Fixer.saveFile</h4>
+<b>saveFile</b>(<i>encoding</i>)
+<p>
+        Public method to save the modified file.
+</p><dl>
+<dt><i>encoding</i></dt>
+<dd>
+encoding of the source file (string)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating success (boolean)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+</body></html>
\ No newline at end of file
--- a/Documentation/Source/index-eric5.Plugins.CheckerPlugins.Pep8.html	Mon Jan 17 11:51:33 2011 +0100
+++ b/Documentation/Source/index-eric5.Plugins.CheckerPlugins.Pep8.html	Mon Jan 17 20:15:54 2011 +0100
@@ -38,6 +38,9 @@
 <td><a href="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html">Pep8Dialog</a></td>
 <td>Module implementing a dialog to show the results of the PEP 8 check.</td>
 </tr><tr>
+<td><a href="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html">Pep8Fixer</a></td>
+<td>Module implementing a class to fix certain PEP 8 issues.</td>
+</tr><tr>
 <td><a href="eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.html">Pep8StatisticsDialog</a></td>
 <td>Module implementing a dialog showing statistical data for the last PEP 8 run.</td>
 </tr><tr>
--- a/Plugins/CheckerPlugins/Pep8/Pep8Dialog.py	Mon Jan 17 11:51:33 2011 +0100
+++ b/Plugins/CheckerPlugins/Pep8/Pep8Dialog.py	Mon Jan 17 20:15:54 2011 +0100
@@ -21,7 +21,7 @@
 from .Pep8Checker import Pep8Checker, Pep8Py2Checker
 from .Pep8CodeSelectionDialog import Pep8CodeSelectionDialog
 from .Pep8StatisticsDialog import Pep8StatisticsDialog
-from .Pep8Fixer import Pep8Fixer
+from .Pep8Fixer import Pep8Fixer, Pep8FixableIssues
 
 from .Ui_Pep8Dialog import Ui_Pep8Dialog
 
@@ -93,7 +93,7 @@
                                   self.resultList.header().sortIndicatorOrder()
                                  )
     
-    def __createResultItem(self, file, line, pos, message):
+    def __createResultItem(self, file, line, pos, message, fixed):
         """
         Private method to create an entry in the result list.
         
@@ -101,6 +101,7 @@
         @param line line number of issue (integer or string)
         @param pos character position of issue (integer or string)
         @param message message text (string)
+        @param fixed flag indicating a fixed issue (boolean)
         """
         if self.__lastFileItem is None:
             # It's a new file
@@ -116,21 +117,30 @@
             itm.setIcon(1, UI.PixmapCache.getIcon("warning.png"))
         else:
             itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError.png"))
+        if fixed:
+            itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed.png"))
+        elif code in Pep8FixableIssues:
+            itm.setIcon(0, UI.PixmapCache.getIcon("issueFixable.png"))
         
         itm.setTextAlignment(0, Qt.AlignRight)
         itm.setTextAlignment(1, Qt.AlignHCenter)
         
+        itm.setTextAlignment(0, Qt.AlignVCenter)
+        itm.setTextAlignment(1, Qt.AlignVCenter)
+        itm.setTextAlignment(2, Qt.AlignVCenter)
+        
         itm.setData(0, self.filenameRole, file)
         itm.setData(0, self.lineRole, int(line))
         itm.setData(0, self.positionRole, int(pos))
         itm.setData(0, self.messageRole, message)
     
-    def __updateStatistics(self, statistics):
+    def __updateStatistics(self, statistics, fixer):
         """
         Private method to update the collected statistics.
         
         @param statistics dictionary of statistical data with
             message code as key and message count as value
+        @param fixer reference to the PEP 8 fixer (Pep8Fixer)
         """
         self.__statistics["_FilesCount"] += 1
         if statistics:
@@ -140,6 +150,8 @@
                     self.__statistics[key] += statistics[key]
                 else:
                     self.__statistics[key] = statistics[key]
+        if fixer:
+            self.__statistics["_IssuesFixed"] += fixer.fixed
     
     def __resetStatistics(self):
         """
@@ -148,6 +160,7 @@
         self.__statistics = {}
         self.__statistics["_FilesCount"] = 0
         self.__statistics["_FilesIssues"] = 0
+        self.__statistics["_IssuesFixed"] = 0
     
     def prepare(self, fileList, project):
         """
@@ -271,7 +284,7 @@
                     self.noResults = False
                     self.__createResultItem(file, "1", "1", 
                         self.trUtf8("Error: {0}").format(str(msg))\
-                            .rstrip()[1:-1])
+                            .rstrip()[1:-1], False)
                     progress += 1
                     continue
                 
@@ -307,15 +320,16 @@
                     if not source[lineno - 1].strip()\
                        .endswith("__IGNORE_WARNING__"):
                         self.noResults = False
+                        fixed = False
                         if fixer:
                             fixed, msg = fixer.fixIssue(lineno, position, text)
                             if fixed:
                                 text += "\n" + \
                                         self.trUtf8("Fix: {0}").format(msg)
                         self.__createResultItem(
-                            fname, lineno, position, text)
+                            fname, lineno, position, text, fixed)
                 fixer and fixer.saveFile(encoding)
-                self.__updateStatistics(checker.statistics)
+                self.__updateStatistics(checker.statistics, fixer)
                 progress += 1
             self.checkProgress.setValue(progress)
             QApplication.processEvents()
--- a/Plugins/CheckerPlugins/Pep8/Pep8Fixer.py	Mon Jan 17 11:51:33 2011 +0100
+++ b/Plugins/CheckerPlugins/Pep8/Pep8Fixer.py	Mon Jan 17 20:15:54 2011 +0100
@@ -16,7 +16,10 @@
 
 import Utilities
 
-Pep8FixableIssues = ["E101", "W191", "E201", "E202", "E203", "E211", "E221", "E222", "E225", "E231", "E241", "E251", "E261", "E262", "W291", "W292", "W293", "E301", "E303", "E304", "W391", "W603"]
+Pep8FixableIssues = ["E101", "W191", "E201", "E202", "E203", "E211", "E221",
+                     "E222", "E225", "E231", "E241", "E251", "E261", "E262",
+                     "W291", "W292", "W293", "E301", "E302", "E303", "E304", 
+                     "W391", "W603"]
 
 class Pep8Fixer(QObject):
     """
@@ -41,6 +44,7 @@
         self.__origName = ""
         self.__source = sourceLines[:]  # save a copy
         self.__fixCodes = [c.strip() for c in fixCodes.split(",") if c.strip()]
+        self.fixed = 0
         
         if not inPlace:
             self.__origName = self.__filename
@@ -66,6 +70,7 @@
             "W292" : self.__fixNewline, 
             "W293" : self.__fixWhitespace,
             "E301" : self.__fixOneBlankLine, 
+            "E302" : self.__fixTwoBlankLines, 
             "E303" : self.__fixTooManyBlankLines, 
             "E304" : self.__fixBlankLinesAfterDecorator, 
             "W391" : self.__fixTrailingBlankLines, 
@@ -121,6 +126,7 @@
             res = self.__fixes[code](code, line, pos)
             if res[0]:
                 self.__modified = True
+                self.fixed += 1
         else:
             res = (False, "")
         
@@ -291,6 +297,45 @@
             self.__stack.append((code, line, pos))
         return (True, self.trUtf8("One blank line inserted."))
     
+    def __fixTwoBlankLines(self, code, line, pos, apply=False):
+        """
+        Private method to fix the need for two blank lines.
+        """
+        # count blank lines
+        index = line - 1
+        blanks = 0
+        while index:
+            if self.__source[index - 1].strip() == "":
+                blanks += 1
+                index -= 1
+            else:
+                break
+        delta = blanks - 2
+        
+        if apply:
+            line -= 1
+            if delta < 0:
+                # insert blank lines (one or two)
+                while delta < 0:
+                    self.__source.insert(line, self.__getEol())
+                    delta += 1
+            elif delta > 0:
+                # delete superfluous blank lines
+                while delta > 0:
+                    del self.__source[line - 1]
+                    line -= 1
+                    delta -= 1
+        else:
+            self.__stack.append((code, line, pos))
+        
+        if delta < 0:
+            msg = self.trUtf8("%n blank line(s) inserted.", "", -delta)
+        elif delta > 0:
+            msg = self.trUtf8("%n superfluous lines removed", "", delta)
+        else:
+            msg = ""
+        return (True, msg)
+    
     def __fixWhitespaceAfter(self, code, line, pos, apply=False):
         """
         Private method to fix superfluous whitespace after '([{'.
@@ -362,9 +407,10 @@
             the fix (string)
         """
         line = line - 1
-        while self.__source[line][pos] in [" ", "\t"]:
-            self.__source[line] = self.__source[line][:pos] + \
-                                  self.__source[line][pos + 1:]
+        while self.__source[line][pos - 1] in [" ", "\t"]:
+            self.__source[line] = self.__source[line][:pos - 1] + \
+                                  self.__source[line][pos:]
+            pos -= 1
         return (True, self.trUtf8("Extraneous whitespace removed."))
     
     def __fixMissingWhitespaceAroundOperator(self, code, line, pos, 
--- a/Plugins/CheckerPlugins/Pep8/Pep8StatisticsDialog.py	Mon Jan 17 11:51:33 2011 +0100
+++ b/Plugins/CheckerPlugins/Pep8/Pep8StatisticsDialog.py	Mon Jan 17 20:15:54 2011 +0100
@@ -34,8 +34,10 @@
         stats = statistics.copy()
         filesCount = stats["_FilesCount"]
         filesIssues = stats["_FilesIssues"]
+        fixesCount = stats["_IssuesFixed"]
         del stats["_FilesCount"]
         del stats["_FilesIssues"]
+        del stats["_IssuesFixed"]
         
         totalIssues = 0
         
@@ -52,6 +54,8 @@
         
         self.total.setText(
             self.trUtf8("%n issue(s) found", "", totalIssues))
+        self.total.setText(
+            self.trUtf8("%n issue(s) fixed", "", fixesCount))
         self.filesChecked.setText(
             self.trUtf8("%n file(s) checked", "", filesCount))
         self.filesIssues.setText(
Binary file icons/default/issueFixable.png has changed
Binary file icons/default/issueFixed.png has changed

eric ide

mercurial