~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to colordiff.py

  • Committer: Aaron Bentley
  • Date: 2007-02-02 14:00:28 UTC
  • Revision ID: abentley@panoramicfeedback.com-20070202140028-8m53m27am3d4twc7
Colordiff warns on long lines

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        self._read_colordiffrc()
57
57
        self.added_trailing_whitespace = 0
58
58
        self.spurious_whitespace = 0
 
59
        self.long_lines = 0
 
60
        self.max_line_len = 79 
59
61
        self._new_lines = []
60
62
        self._old_lines = []
61
63
        self.check_style = check_style
106
108
        elif isinstance(item, InsertLine):
107
109
            if item.contents.endswith(' \n'):
108
110
                self.added_trailing_whitespace += 1
 
111
            if len(item.contents) > self.max_line_len:
 
112
                self.long_lines += 1
109
113
            line_class = 'newtext'
110
114
            self._new_lines.append(item)
111
115
        elif isinstance(item, RemoveLine):
158
162
        if dw.added_trailing_whitespace > 0:
159
163
            trace.warning('%d new line(s) have trailing whitespace.' %
160
164
                          dw.added_trailing_whitespace)
 
165
        if dw.long_lines > 0:
 
166
            trace.warning('%d new line(s) exceed(s) %d columns.' %
 
167
                          (dw.long_lines, dw.max_line_len))
161
168
        if dw.spurious_whitespace > 0:
162
169
            trace.warning('%d line(s) have spurious whitespace changes' %
163
170
                          dw.spurious_whitespace)
164