Skip to content

Commit c9b2b06

Browse files
committed
Fix running pylint on bin/bugzilla
pylint seems to get confused by being pointed at a script named 'bugzilla' and a library named 'bugzilla'. Add a top level bugzilla-cli link which fixes the namespace issues. Clean up the fall out.
1 parent 7fdb5e9 commit c9b2b06

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

bin/bugzilla

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ def generate_man_page():
407407

408408
today = datetime.date.today()
409409
datestr = today.strftime("%B %d, %Y")
410+
411+
# pylint: disable=W1401
412+
# Anomalous backslash in string, man format confuses pylint
410413
manpage = \
411414
'''.TH bugzilla 1 "%s" "version %s" "User Commands"
412415
.SH NAME
@@ -689,7 +692,7 @@ def _convert_to_outputformat(output):
689692
fmt += "[%{target_milestone}] %{flags} %{cve}"
690693

691694
else:
692-
raise RuntimeError("Unknown output type '%s'" % opt.output)
695+
raise RuntimeError("Unknown output type '%s'" % output)
693696

694697
return fmt
695698

bugzilla-cli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/bugzilla

bugzilla/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
log = logging.getLogger("bugzilla")
1919

2020

21+
from bugzilla.base import BugzillaBase as _BugzillaBase
2122
from bugzilla.base import BugzillaError
2223
from bugzilla.bugzilla3 import Bugzilla3, Bugzilla32, Bugzilla34, Bugzilla36
2324
from bugzilla.bugzilla4 import Bugzilla4, Bugzilla42, Bugzilla44
@@ -88,29 +89,33 @@ def getBugzillaClassForURL(url):
8889
return c
8990

9091

91-
class Bugzilla(object):
92+
class Bugzilla(_BugzillaBase):
9293
'''
9394
Magical Bugzilla class that figures out which Bugzilla implementation
9495
to use and uses that. Requires 'url' parameter so we can check available
9596
XMLRPC methods to determine the Bugzilla version.
9697
'''
98+
# pylint: disable=W0231
99+
# __init__ method of base class not called
100+
97101
def __init__(self, **kwargs):
98102
log.info("Bugzilla v%s initializing" % __version__)
99103
if 'url' not in kwargs:
100104
raise TypeError("You must pass a valid bugzilla URL")
101105

102106
# pylint: disable=W0233
103107
# Use of __init__ of non parent class
108+
# We base of _BugzillaBase to help pylint figure things out
104109

105110
c = getBugzillaClassForURL(kwargs['url'])
106111
if not c:
107112
raise ValueError("Couldn't determine Bugzilla version for %s" %
108113
kwargs['url'])
109114

110-
if c:
111-
self.__class__ = c
112-
c.__init__(self, **kwargs)
113-
log.info("Chose subclass %s v%s" % (c.__name__, c.version))
115+
self.__class__ = c
116+
c.__init__(self, **kwargs)
117+
log.info("Chose subclass %s v%s" % (c.__name__, c.version))
118+
114119

115120
# This is the list of possible Bugzilla instances an app can use,
116121
# bin/bugzilla uses it for the --bztype field

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ def run(self):
148148
# W0212: Access to a protected member of a client class
149149
"--disable W0212 "
150150

151-
"bugzilla/ bin/bugzilla tests/*.py ")
151+
"bugzilla/ bugzilla-cli tests/*.py ")
152152

153153
os.system("pep8 --format=pylint "
154-
"bugzilla/ bin/bugzilla tests/ "
154+
"bugzilla/ bugzilla-cli tests/ "
155155
# E303: Too many blank lines
156156
# E125: Continuation indent isn't different from next block
157157
# E128: Not indented for visual style

0 commit comments

Comments
 (0)