changeset 2566:96742f62f1a6

improve coding_std.py by replacing tabs with 4 spaces
author RogerHaase <haaserd@gmail.com>
date Sat, 01 Mar 2014 12:05:44 -0700
parents 2d205939e80e
children 81373904efeb
files contrib/pep8/coding_std.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/pep8/coding_std.py	Sat Mar 01 10:50:21 2014 -0700
+++ b/contrib/pep8/coding_std.py	Sat Mar 01 12:05:44 2014 -0700
@@ -69,6 +69,10 @@
 
     with open(filename, "wb") as f:
         for line in lines:
+            length_line = len(line)
+            line = line.replace('\t', '    ')
+            if len(line) != length_line:
+                logger.log(u"%s was changed to replace tab characters with 4 spaces" % filename)
             pep8_line = line.rstrip() + line_end
             f.write(pep8_line)
             # if line was changed, issue warning once for each type of change