Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions vigil
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env python

from __future__ import print_function
from builtins import filter
from builtins import range
import re
import sys
import traceback
Expand Down Expand Up @@ -33,7 +36,7 @@ def punish(line, offense):

# Clear the lines, but don't delete them. That way later failures will
# have the right line number.
for i in xrange(start, end + 1):
for i in range(start, end):
source_lines[i] = ''

def vigil_implore(ok, expr):
Expand All @@ -53,27 +56,27 @@ def vigil_done():
return

# Strip out the dirty impure lines.
cleansed = filter(len, source_lines)
cleansed = list(filter(len, source_lines))
with open(source_path, 'w') as f:
f.writelines(cleansed)

print ""
print ""
print "------------------------------------------------------------------"
print ""
print "The ever vigilant watchers of your code have found malfeasance in:"
print ""
print("")
print("")
print("------------------------------------------------------------------")
print("")
print("The ever vigilant watchers of your code have found malfeasance in:")
print("")

for fn, offense, _ in offenders:
print fn
print "Crime:", offense
print ""
print(fn)
print("Crime:", offense)
print("")

print "Each has been dealt an appropriate punishment."
print("Each has been dealt an appropriate punishment.")

def vigil_uncaught():
raise_line = traceback.extract_tb(sys.exc_info()[2])[-1][1]
print "uncaught error from line ", raise_line
print("uncaught error from line ", raise_line)
punish(raise_line, "Raised '%s' which was not caught." % sys.exc_info()[1])

try:
Expand Down