Remove reason from suggested fixes

If there's a reason why a change is not a 1:1, do not print it in the
list of suggestions.
This commit is contained in:
Lucas De Marchi
2011-01-29 10:48:23 -02:00
parent 049da20953
commit b11405edf7
3 changed files with 24 additions and 5 deletions

View File

@ -20,10 +20,10 @@ options = None
# file1 .. fileN Files to check spelling
class Mispell:
def __init__(self, data, fix):
def __init__(self, data, fix, reason):
self.data = data
self.fix = fix
self.reason = reason
class TermColors:
def __init__(self):
@ -66,7 +66,18 @@ def build_dict(filename):
with open(filename, 'r') as f:
for line in f:
[key, data] = line.split('->')
misspellings[key] = Mispell(data, data.find(',') + 1)
fix = data.find(',')
if fix != (len(data) - 1) and fix > 0:
reason = data.split(',')[-1]
else:
reason = ''
if fix > 0:
fix = True
data = "%s\n" % data[:data.rfind(',')]
misspellings[key] = Mispell(data, fix, reason)
def parse_file(filename, colors):
if filename == '-':