changeset 1757:22c5d8b59163

add .styl to list of file suffixes checked; use unicode strings for messages
author Roger Haase <crosseyedpenguin@yahoo.com>
date Tue, 28 Aug 2012 14:06:56 -0700
parents 2ae7384dd311
children 0130532006c4
files contrib/pep8/DeleteTrailingSpaces.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/pep8/DeleteTrailingSpaces.py	Tue Aug 28 14:05:09 2012 -0700
+++ b/contrib/pep8/DeleteTrailingSpaces.py	Tue Aug 28 14:06:56 2012 -0700
@@ -6,7 +6,7 @@
 Detect and correct violations of the moin2 coding standards:
     - no trailing blanks
     - exactly one linefeed at file end, see PEP8
-    - DOS line endings on .bat files, unix line endings everywhere else
+    - DOS line endings on .bat and .cmd files, unix line endings everywhere else
 
 Execute this script from the root directory of the moin2 repository or
 from anywhere within the contrib path.
@@ -17,7 +17,7 @@
 warnings.simplefilter("once")
 
 # file types to be processed
-SELECTED_SUFFIXES = set("py bat cmd html css js".split())
+SELECTED_SUFFIXES = set("py bat cmd html css js styl".split())
 
 # stuff considered DOS/WIN
 WIN_SUFFIXES = set("bat cmd".split())
@@ -51,6 +51,7 @@
     while lines:
         if not lines[-1].strip():
             del lines[-1]
+            warnings.warn(u"%s was changed to remove empty lines at eof" % filename)
         else:
             break
 
@@ -60,11 +61,11 @@
             f.write(pep8_line)
             # if line was changed, issue warning once for each type of change
             if suffix in WIN_SUFFIXES and not line.endswith("\r\n"):
-                warnings.warn("%s was changed to DOS line endings" % filename)
+                warnings.warn(u"%s was changed to DOS line endings" % filename)
             elif suffix not in WIN_SUFFIXES and line.endswith("\r\n"):
-                warnings.warn("%s was changed to Unix line endings" % filename)
+                warnings.warn(u"%s was changed to Unix line endings" % filename)
             elif pep8_line != line:
-                warnings.warn("%s was changed to remove trailing blanks" % filename)
+                warnings.warn(u"%s was changed to remove trailing blanks" % filename)
 
 
 def file_picker(starting_dir):
@@ -90,5 +91,5 @@
     else:
         starting_dir = os.path.abspath(os.path.dirname(__file__))
         starting_dir = starting_dir.split(os.sep + 'contrib')[0]
-    warnings.warn("%s is starting directory" % starting_dir)
+    warnings.warn(u"%s is starting directory" % starting_dir)
     file_picker(starting_dir)