check-code: find trailing whitespace
authorMartin Geisler <mg@lazybytes.net>
Wed, 20 Oct 2010 10:13:04 +0200
changeset 12770 614f0d8724ab
parent 12769 daa8dc6e1f66
child 12771 c77f6276c9e7
check-code: find trailing whitespace
contrib/check-code.py
hgext/convert/subversion.py
mercurial/dispatch.py
mercurial/encoding.py
mercurial/subrepo.py
mercurial/url.py
--- a/contrib/check-code.py	Wed Oct 20 10:07:38 2010 +0200
+++ b/contrib/check-code.py	Wed Oct 20 10:13:04 2010 +0200
@@ -110,6 +110,7 @@
     (r'.{85}', "line too long"),
     (r'.{81}', "warning: line over 80 characters"),
     (r'[^\n]\Z', "no trailing newline"),
+    (r'(\S\s+|^\s+)\n', "trailing whitespace"),
 #    (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
 #    (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
     (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
--- a/hgext/convert/subversion.py	Wed Oct 20 10:07:38 2010 +0200
+++ b/hgext/convert/subversion.py	Wed Oct 20 10:13:04 2010 +0200
@@ -651,7 +651,7 @@
                 else:
                     self.ui.debug('unknown path in revision %d: %s\n' % \
                                   (revnum, path))
-            elif kind == svn.core.svn_node_dir:                
+            elif kind == svn.core.svn_node_dir:
                 if ent.action == 'M':
                     # If the directory just had a prop change,
                     # then we shouldn't need to look for its children.
@@ -823,7 +823,7 @@
     def getfile(self, file, rev):
         # TODO: ra.get_file transmits the whole file instead of diffs.
         if file in self.removed:
-            raise IOError()         
+            raise IOError()
         mode = ''
         try:
             new_module, revnum = self.revsplit(rev)[1:]
@@ -892,7 +892,7 @@
         finally:
             if module is not None:
                 self.reparent(prevmodule)
-    
+
     def _getlog(self, paths, start, end, limit=0, discover_changed_paths=True,
                 strict_node_history=False):
         # Normalize path names, svn >= 1.5 only wants paths relative to
--- a/mercurial/dispatch.py	Wed Oct 20 10:07:38 2010 +0200
+++ b/mercurial/dispatch.py	Wed Oct 20 10:13:04 2010 +0200
@@ -407,7 +407,7 @@
 
 def _getlocal(ui, rpath):
     """Return (path, local ui object) for the given target path.
-    
+
     Takes paths in [cwd]/.hg/hgrc into account."
     """
     try:
--- a/mercurial/encoding.py	Wed Oct 20 10:07:38 2010 +0200
+++ b/mercurial/encoding.py	Wed Oct 20 10:13:04 2010 +0200
@@ -15,7 +15,7 @@
     for Python 2.7 and up. This is the same corrected code for earlier
     Python versions.
 
-    However, we can't use a version check for this method, as some distributions 
+    However, we can't use a version check for this method, as some distributions
     patch Python to fix this. Instead, we use it as a 'fixer' for the mac-roman
     encoding, as it is unlikely that this encoding is the actually expected.
     '''
--- a/mercurial/subrepo.py	Wed Oct 20 10:07:38 2010 +0200
+++ b/mercurial/subrepo.py	Wed Oct 20 10:13:04 2010 +0200
@@ -192,7 +192,7 @@
         if repo.ui.config('paths', 'default'):
             return repo.ui.config('paths', 'default')
     if abort:
-        raise util.Abort(_("default path for subrepository %s not found") % 
+        raise util.Abort(_("default path for subrepository %s not found") %
             reporelpath(repo))
 
 def itersubrepos(ctx1, ctx2):
--- a/mercurial/url.py	Wed Oct 20 10:07:38 2010 +0200
+++ b/mercurial/url.py	Wed Oct 20 10:13:04 2010 +0200
@@ -489,7 +489,7 @@
 def _verifycert(cert, hostname):
     '''Verify that cert (in socket.getpeercert() format) matches hostname.
     CRLs and subjectAltName are not handled.
-    
+
     Returns error message if any problems are found and None on success.
     '''
     if not cert: