Skip to content

Instantly share code, notes, and snippets.

@tracymiranda tracymiranda/
Last active Feb 10, 2016

What would you like to do?
This script runs with Eclipse EASE Jython engine. It adds an Eclipse Task Marker for all printStackTrace lines it detects in java files in the workspace.
from org.eclipse.core.resources import IMarker
for ifile in findFiles("*.java"):
file_name = str(ifile.getLocation())
print "Processing " + file_name
with open(file_name) as f:
for line_no, line in enumerate(f, start=1):
if "printStackTrace" in line:
marker = ifile.createMarker(IMarker.TASK)
marker.setAttribute(IMarker.TRANSIENT, True)
marker.setAttribute(IMarker.LINE_NUMBER, line_no)
marker.setAttribute(IMarker.MESSAGE, "Fix in Sprint 2: " + line.strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.