Mercurial > hg > check_whitespace
changeset 2:adc4e99b4a4a
Added test for conflict markers.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Mon, 02 Apr 2012 22:28:07 +0200 (2012-04-02) |
parents | c3189b033899 |
children | 561cb4f73b83 |
files | check_whitespace.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/check_whitespace.py Sun Jun 20 16:47:47 2010 +0200 +++ b/check_whitespace.py Mon Apr 02 22:28:07 2012 +0200 @@ -16,6 +16,7 @@ lnre = re.compile(r'@@ -\d+,\d+ \+(?P<lineno>\d+),') wsre = re.compile(r'\+.*[ \t]$') tbre = re.compile(r'\+.*\t') + resre = re.compile(r'\+(<<<<<<<|>>>>>>>)') for line in difflines: if header: @@ -41,10 +42,15 @@ m = tbre.match(line) if m is not None: yield filename, linenum, 'TABs' + # trailing whitespace, for now only in Python source m = wsre.match(line) if m is not None: if filename[-3:] == '.py' or filename[-5:] == '.py.in': yield filename, linenum, 'trailing whitespace' + # conflict markers + m = resre.match(line) + if m is not None: + yield filename, linenum, 'conflict marker' if line and line[0] in ' +': linenum += 1