Bugtracker: General overhaul.

* Improve regex matching.
* Improve CVE and OOPS handling.
* Fix various minor things.
* Drop outdated and unused code.
This commit is contained in:
Krytarik Raido 2018-03-09 19:56:04 +01:00
parent 9ab4725d49
commit 1e4fc7f3d0
3 changed files with 253 additions and 547 deletions

View File

@ -24,7 +24,7 @@ import supybot.world as world
from imp import reload from imp import reload
__version__ = "2.7.0" __version__ = "2.8.0"
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@tuxgarage.com") __author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@tuxgarage.com")
__contributors__ = { __contributors__ = {
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'], supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'],

View File

@ -33,25 +33,25 @@ def configure(advanced):
def getRepeatdelay(): def getRepeatdelay():
output("How many seconds should the bot wait before repeating bug information?") output("How many seconds should the bot wait before repeating bug information?")
repeatdelay = something("Enter a number greater or equal to 0", default=Bugtracker.repeatdelay._default) repeatdelay = something("Enter a number greater or equal to 0.", default=Bugtracker.repeatdelay._default)
try: try:
repeatdelay = int(repeatdelay) repeatdelay = int(repeatdelay)
if repeatdelay < 0: if repeatdelay < 0:
raise TypeError raise TypeError
except TypeError: except TypeError:
output("%r is an invalid value, it must be an integer greater or equal to 0" % repeatdelay) output("Invalid value '%s', it must be an integer greater or equal to 0." % repeatdelay)
return getRepeatdelay() return getRepeatdelay()
else: else:
return repeatdelay return repeatdelay
output("Each of the next 3 questions can be set per-channel with the '@Config channel' command") output("Each of the next 3 questions can be set per-channel with the '@config channel' command.")
bugSnarfer = yn("Enable detecting bugs numbers and URL in all channels?", default=Bugtracker.bugSnarfer._default) bugSnarfer = yn("Enable detecting bugs numbers and URL in all channels?", default=Bugtracker.bugSnarfer._default)
cveSnarfer = yn("Enable detecting CVE numbers and URL in all channels?", default=Bugtracker.cveSnarfer._default) cveSnarfer = yn("Enable detecting CVE numbers and URL in all channels?", default=Bugtracker.cveSnarfer._default)
oopsSnarfer = yn("Enable detecting Launchpad OOPS IDs in all channels?", default=Bugtracker.oopsSnarfer._default) oopsSnarfer = yn("Enable detecting Launchpad OOPS IDs in all channels?", default=Bugtracker.oopsSnarfer._default)
if advanced: if advanced:
replyNoBugtracker = something("What should the bot reply with when a a user requests information from an unknown bug tracker?", default=Bugtracker.replyNoBugtracker._default) replyNoBugtracker = something("What should the bot reply with when a user requests information from an unknown bug tracker?", default=Bugtracker.replyNoBugtracker._default)
snarfTarget = something("What should be the default bug tracker used when one isn't specified?", default=Bugtracker.snarfTarget._default) snarfTarget = something("What should be the default bug tracker used when none is specified?", default=Bugtracker.snarfTarget._default)
replyWhenNotFound = yn("Should the bot report when a bug is not found?", default=Bugtracker.replyWhenNotFound._default) replyWhenNotFound = yn("Should the bot report when a bug is not found?", default=Bugtracker.replyWhenNotFound._default)
repeatdelay = getRepeatdelay() repeatdelay = getRepeatdelay()
else: else:
@ -77,7 +77,7 @@ Bugtracker = conf.registerPlugin('Bugtracker')
conf.registerChannelValue(Bugtracker, 'bugSnarfer', conf.registerChannelValue(Bugtracker, 'bugSnarfer',
registry.Boolean(False, """Determines whether the bug snarfer will be registry.Boolean(False, """Determines whether the bug snarfer will be
enabled, such that any Bugtracker URLs and bug ### seen in the channel enabled, such that any bugtracker URLs and bug ### seen in the channel
will have their information reported into the channel.""")) will have their information reported into the channel."""))
conf.registerChannelValue(Bugtracker, 'cveSnarfer', conf.registerChannelValue(Bugtracker, 'cveSnarfer',
@ -90,11 +90,8 @@ conf.registerChannelValue(Bugtracker, 'oopsSnarfer',
enabled, such that any OOPS ### seen in the channel enabled, such that any OOPS ### seen in the channel
will have their information reported into the channel.""")) will have their information reported into the channel."""))
#conf.registerChannelValue(Bugtracker, 'bugReporter',
# registry.String('', """Report new bugs (experimental)"""))
conf.registerChannelValue(Bugtracker, 'replyNoBugtracker', conf.registerChannelValue(Bugtracker, 'replyNoBugtracker',
registry.String('I don\'t have a bugtracker %s.', """Determines the phrase registry.String("I have no bugtracker '%s'", """Determines the phrase
to use when notifying the user that there is no information about that to use when notifying the user that there is no information about that
bugtracker site.""")) bugtracker site."""))
@ -116,20 +113,4 @@ conf.registerChannelValue(Bugtracker, 'showassignee',
registry.Boolean(False, """Whether to show the assignee in bug reports""")) registry.Boolean(False, """Whether to show the assignee in bug reports"""))
conf.registerChannelValue(Bugtracker, 'extended', conf.registerChannelValue(Bugtracker, 'extended',
registry.Boolean(False, "Show optional extneded bug information, specific to trackers")) registry.Boolean(False, """Whether to show extended bug information, specific to trackers"""))
#conf.registerGlobalValue(Bugtracker, 'reportercache',
# registry.String('', """Name of the basedir for the bugreporter cache""", private=True))
#conf.registerGlobalValue(Bugtracker, 'imap_server',
# registry.String('', """IMAP server for bugmail account""",private=True))
#conf.registerGlobalValue(Bugtracker, 'imap_user',
# registry.String('', """IMAP user for bugmail account""", private=True))
#conf.registerGlobalValue(Bugtracker, 'imap_password',
# registry.String('', """IMAP password for bugmail account""", private=True))
#conf.registerGlobalValue(Bugtracker, 'imap_ssl',
# registry.Boolean(False, """Use SSL for imap connections""", private=True))

File diff suppressed because it is too large Load Diff