[Libreoffice-commits] core.git: bin/find-german-comments

Philipp Weissenbacher p.weissenbacher at gmail.com
Wed Jul 23 01:02:41 PDT 2014


 bin/find-german-comments |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 192338bbc363bbcf71ddbfff8f933d69a822c215
Author: Philipp Weissenbacher <p.weissenbacher at gmail.com>
Date:   Wed Jul 23 00:26:08 2014 +0200

    Run pylint on find-german-comments
    
    I ran pylint and corrected the following errors:
    
    * W: 39,0: Unnecessary semicolon
    * W:177,0: Bad indentation. Found 19 spaces, expected 20
    * W:178,0: Bad indentation. Found 19 spaces, expected 20
    * W:213,0: Unnecessary semicolon
    * W: 65,8:Parser.get_comments: Unused variable 'linenum'
    * C:190,28:Parser.check_file: Operator not preceded by a space
    * C:192,24:Parser.check_file: Operator not followed by a space
    * C:196,24:Parser.check_file: Comma not followed by a space
    * W:223,33:Parser.check_source_files: Redefining built-in 'dir'
    
    Change-Id: Idd4986fecb7b3a2af87d1062b7d08c6c87b9f80f
    Reviewed-on: https://gerrit.libreoffice.org/10475
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/bin/find-german-comments b/bin/find-german-comments
index 155d9d6..f040f89 100755
--- a/bin/find-german-comments
+++ b/bin/find-german-comments
@@ -36,7 +36,7 @@ class Parser:
     """
     def __init__(self):
         self.strip = string.punctuation + " \n"
-        self.text_cat = self.start_text_cat();
+        self.text_cat = self.start_text_cat()
         op = optparse.OptionParser()
         op.set_usage("%prog [options] <rootdir>\n\n" +
             "Searches for german comments in cxx/hxx source files inside a given root\n" +
@@ -174,8 +174,8 @@ class Parser:
                 sys.stderr.write("%s ... %s positives -- %s\n" % (path, str(len(path_linenums)), str(valid)))
             if valid:
                 if self.options.line_numbers_pos:
-                   sys.stderr.write("%s ... %s positives\n" % (path, str(len(path_linenums))))
-                   return
+                    sys.stderr.write("%s ... %s positives\n" % (path, str(len(path_linenums))))
+                    return
                 if len(path) + (len(path_linenums)*4) > 75:
                     print "%s:\n" % path
                     while(path_linenums):
@@ -187,13 +187,13 @@ class Parser:
                                 path_linenums.remove(path_linenums[0])
                             except IndexError:
                                 i = 10
-                            i+=1
+                            i += 1
                         numline = [str(i) for i in numline]
-                        print "%s%s" %(TABS, ",".join(numline))
+                        print "%s%s" % (TABS, ",".join(numline))
                 else:
                     if self.options.line_numbers:
                         path_linenums = [str(i) for i in path_linenums]
-                        print "%s:%s%s" % (path,"\t"*tab_calc(path),",".join(path_linenums))
+                        print "%s:%s%s" % (path, "\t"*tab_calc(path), ",".join(path_linenums))
 
         elif not self.options.filenames_only:
             for linenum, s in self.get_comments(path):
@@ -210,7 +210,7 @@ class Parser:
                 print f
 
     def first_elem(self, path):
-        lastElem = os.path.dirname(path);
+        lastElem = os.path.dirname(path)
         done = False
         while not done:
             nextElem = os.path.split(lastElem)[0]
@@ -220,11 +220,11 @@ class Parser:
                 done = True
         return lastElem
 
-    def check_source_files(self, dir):
+    def check_source_files(self, directory):
         """
         checks each _tracked_ file in a directory recursively
         """
-        sock = os.popen(r"git ls-files '%s' |egrep '\.(c|h)xx$'" % dir)
+        sock = os.popen(r"git ls-files '%s' |egrep '\.(c|h)xx$'" % directory)
         lines = sock.readlines()
         sock.close()
 


More information about the Libreoffice-commits mailing list