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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| loadModule('/System/Resources') | |
| 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