Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #12655: Use pylint to verify python code in rudder repo #1935

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions qa-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

find . -name '*.py' | xargs pylint -E --disable=C,R --persistent=n
14 changes: 7 additions & 7 deletions rudder-core/src/test/resources/convertOpenLDAPSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def main(argv=None):
try:
try:
opts, args = getopt.getopt(argv[1:], "ho:v", ["help", "output="])
except getopt.error, msg:
except getopt.error as msg:
raise Usage(msg)

# option processing
Expand All @@ -73,18 +73,18 @@ def main(argv=None):
output = value


except Usage, err:
except Usage as err:
print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg)
print >> sys.stderr, "\t for help use --help"
return 2
try:
infile = open(args[0], "r")
except Usage, err:
except Usage as err:
print >> sys.stderr, "Can't open file: " + str(err.msg)
if output != "":
try:
outfile = open(output, "w")
except Usage, err:
except Usage as err:
print >> sys.stderr, "Can't open output file: " + str(err.msg)
else:
outfile = sys.stdout
Expand Down Expand Up @@ -116,7 +116,7 @@ def main(argv=None):
else:
# The OID is a name. Replace string with the OID
repl = IDs[subattr[0]]
newline = string.replace(i, subattr[0], repl, 1)
newline = i.replace(subattr[0], repl, 1)
seclineoid = 0

if re.match("attributetype ", i, re.IGNORECASE):
Expand All @@ -134,7 +134,7 @@ def main(argv=None):
else:
# The OID is a name. Replace string with the OID
repl = IDs[subattr[2]]
newline = string.replace(newline, subattr[2], repl, 1)
newline = newline.replace(subattr[2], repl, 1)

if re.match("objectclass ", i, re.IGNORECASE):
newline = re.sub("object[cC]lass", "objectClasses:", i)
Expand All @@ -151,7 +151,7 @@ def main(argv=None):
else:
# The OID is a name. Replace string with the OID
repl = IDs[subattr[2]]
newline = string.replace(newline, subattr[2], repl, 1)
newline = newline.replace(subattr[2], repl, 1)

# Remove quoted syntax.
if re.search("SYNTAX\s'[\d.]+'", newline):
Expand Down