[Pydev-cvs] org.python.pydev/src/org/python/pydev/builder/pylint PyLintVisitor.java,1.18,1.19
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2005-06-03 18:50:22
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/pylint In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7006/src/org/python/pydev/builder/pylint Modified Files: PyLintVisitor.java Log Message: almost there... Index: PyLintVisitor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/builder/pylint/PyLintVisitor.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PyLintVisitor.java 1 Jun 2005 10:52:58 -0000 1.18 --- PyLintVisitor.java 3 Jun 2005 18:49:38 -0000 1.19 *************** *** 1,5 **** /* * Created on Oct 25, 2004 ! * * @author Fabio Zadrozny */ --- 1,6 ---- /* + * License: Common Public License v1.0 * Created on Oct 25, 2004 ! * * @author Fabio Zadrozny */ *************** *** 26,29 **** --- 27,31 ---- import org.python.pydev.builder.PyDevBuilderVisitor; import org.python.pydev.plugin.PydevPlugin; + import org.python.pydev.utils.REF; import org.python.pydev.utils.SimplePythonRunner; *************** *** 151,155 **** IProject project = resource.getProject(); ! String output = SimplePythonRunner.runAndGetOutput(script.getAbsolutePath(), lintargs+arg.getAbsolutePath(), script.getParentFile(), project); StringTokenizer tokenizer = new StringTokenizer(output, "\r\n"); --- 153,157 ---- IProject project = resource.getProject(); ! String output = SimplePythonRunner.runAndGetOutput(REF.getFileAbsolutePath(script), lintargs+REF.getFileAbsolutePath(arg), script.getParentFile(), project); StringTokenizer tokenizer = new StringTokenizer(output, "\r\n"); *************** *** 161,165 **** boolean useR = PyLintPrefPage.useRefactorTips(); ! while(tokenizer.hasMoreTokens()){ String tok = tokenizer.nextToken(); --- 163,171 ---- boolean useR = PyLintPrefPage.useRefactorTips(); ! //System.out.println(output); ! if(output.indexOf("Traceback (most recent call last):") != -1){ ! PydevPlugin.log(new RuntimeException("PyLint ERROR: \n"+output)); ! return; ! } while(tokenizer.hasMoreTokens()){ String tok = tokenizer.nextToken(); *************** *** 172,194 **** //F0001: 0: Unable to load module test.test2 (list index out of range) //C0321: 25:fdfd: More than one statement on a single line ! if(tok.startsWith("C")&& useC && tok.indexOf(":") != -1){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_WARNING; ! } ! else if(tok.startsWith("R") && useR && tok.indexOf(":") != -1){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_WARNING; ! } ! else if(tok.startsWith("W") && useW && tok.indexOf(":") != -1){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_WARNING; ! } ! else if(tok.startsWith("E") && useE && tok.indexOf(":") != -1){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_ERROR; ! } ! else if(tok.startsWith("F") && useF && tok.indexOf(":") != -1){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_ERROR; } --- 178,209 ---- //F0001: 0: Unable to load module test.test2 (list index out of range) //C0321: 25:fdfd: More than one statement on a single line ! int indexOfDoublePoints = tok.indexOf(":"); ! if(indexOfDoublePoints != -1){ ! ! if(tok.startsWith("C")&& useC){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_WARNING; ! } ! else if(tok.startsWith("R") && useR ){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_WARNING; ! } ! else if(tok.startsWith("W") && useW ){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_WARNING; ! } ! else if(tok.startsWith("E") && useE ){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_ERROR; ! } ! else if(tok.startsWith("F") && useF ){ ! type = PYLINT_PROBLEM_MARKER; ! priority = Marker.SEVERITY_ERROR; ! }else{ ! continue; ! } ! ! }else{ ! continue; } *************** *** 198,203 **** String id = tok.substring(0, tok.indexOf(":")).trim(); ! tok = tok.substring(tok.indexOf(":")+1); ! int line = Integer.parseInt(tok.substring(0, tok.indexOf(":")).trim() ); IRegion region = null; --- 213,227 ---- String id = tok.substring(0, tok.indexOf(":")).trim(); ! int i = tok.indexOf(":"); ! if(i == -1) ! continue; ! ! tok = tok.substring(i+1); ! ! i = tok.indexOf(":"); ! if(i == -1) ! continue; ! ! int line = Integer.parseInt(tok.substring(0, i).trim() ); IRegion region = null; *************** *** 217,228 **** } ! tok = tok.substring(tok.indexOf(":")+1); addToMarkers(tok, type, priority, id, line); } } catch (RuntimeException e2) { ! e2.printStackTrace(); } } catch (Exception e1) { ! e1.printStackTrace(); } } --- 241,256 ---- } ! i = tok.indexOf(":"); ! if(i == -1) ! continue; ! ! tok = tok.substring(i+1); addToMarkers(tok, type, priority, id, line); } } catch (RuntimeException e2) { ! PydevPlugin.log(e2); } } catch (Exception e1) { ! PydevPlugin.log(e1); } } *************** *** 247,251 **** IFile file = (IFile) resource; ! IPath location = PydevPlugin.getLocation(file.getFullPath()); PyLintThread thread = new PyLintThread(resource, document, location); --- 275,279 ---- IFile file = (IFile) resource; ! IPath location = PydevPlugin.getLocation(file.getFullPath(), project); PyLintThread thread = new PyLintThread(resource, document, location); |