Kaydet (Commit) 192338bb authored tarafından Philipp Weissenbacher's avatar Philipp Weissenbacher Kaydeden (comit) Caolán McNamara

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/10475Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 8f4cba86
...@@ -36,7 +36,7 @@ class Parser: ...@@ -36,7 +36,7 @@ class Parser:
""" """
def __init__(self): def __init__(self):
self.strip = string.punctuation + " \n" self.strip = string.punctuation + " \n"
self.text_cat = self.start_text_cat(); self.text_cat = self.start_text_cat()
op = optparse.OptionParser() op = optparse.OptionParser()
op.set_usage("%prog [options] <rootdir>\n\n" + op.set_usage("%prog [options] <rootdir>\n\n" +
"Searches for german comments in cxx/hxx source files inside a given root\n" + "Searches for german comments in cxx/hxx source files inside a given root\n" +
...@@ -174,8 +174,8 @@ class Parser: ...@@ -174,8 +174,8 @@ class Parser:
sys.stderr.write("%s ... %s positives -- %s\n" % (path, str(len(path_linenums)), str(valid))) sys.stderr.write("%s ... %s positives -- %s\n" % (path, str(len(path_linenums)), str(valid)))
if valid: if valid:
if self.options.line_numbers_pos: if self.options.line_numbers_pos:
sys.stderr.write("%s ... %s positives\n" % (path, str(len(path_linenums)))) sys.stderr.write("%s ... %s positives\n" % (path, str(len(path_linenums))))
return return
if len(path) + (len(path_linenums)*4) > 75: if len(path) + (len(path_linenums)*4) > 75:
print "%s:\n" % path print "%s:\n" % path
while(path_linenums): while(path_linenums):
...@@ -187,13 +187,13 @@ class Parser: ...@@ -187,13 +187,13 @@ class Parser:
path_linenums.remove(path_linenums[0]) path_linenums.remove(path_linenums[0])
except IndexError: except IndexError:
i = 10 i = 10
i+=1 i += 1
numline = [str(i) for i in numline] numline = [str(i) for i in numline]
print "%s%s" %(TABS, ",".join(numline)) print "%s%s" % (TABS, ",".join(numline))
else: else:
if self.options.line_numbers: if self.options.line_numbers:
path_linenums = [str(i) for i in path_linenums] 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: elif not self.options.filenames_only:
for linenum, s in self.get_comments(path): for linenum, s in self.get_comments(path):
...@@ -210,7 +210,7 @@ class Parser: ...@@ -210,7 +210,7 @@ class Parser:
print f print f
def first_elem(self, path): def first_elem(self, path):
lastElem = os.path.dirname(path); lastElem = os.path.dirname(path)
done = False done = False
while not done: while not done:
nextElem = os.path.split(lastElem)[0] nextElem = os.path.split(lastElem)[0]
...@@ -220,11 +220,11 @@ class Parser: ...@@ -220,11 +220,11 @@ class Parser:
done = True done = True
return lastElem return lastElem
def check_source_files(self, dir): def check_source_files(self, directory):
""" """
checks each _tracked_ file in a directory recursively 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() lines = sock.readlines()
sock.close() sock.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment