Extend the bugzilla/irc gateway with two new options
ClosedPublic

Authored by rempt on Sep 19 2017, 2:03 PM.

Details

Summary

I couldn't run this, but this basically adds a compact and a newonly option to the gateway. The first posts all the information in one line, instead of three, and the second makes it possible to only post new bugs.

Diff Detail

Repository
R498 IRC notifications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rempt created this revision.Sep 19 2017, 2:03 PM

This looks okay from my perspective, however I don't see where the call to summary() was changed to supply the new argument you've added?

victorw added inline comments.
bugzilla/bugzilla-to-irker.py
88

This is not strictly part of this review, though since I'm looking at the code I would like to raise a warning flag here: Blanket try-except-continue/pass blocks are generally bad as they will hide any error, including completely invalid code, such as typos.

Example:

def my_function(val):
    set_important_value(val)

try:
    my_funcion(program_state)
except:
    pass

It will eventually make the code very hard to debug and maintain. Unfortunately the Python documentation is not always great at listing exceptions that should be handled, though in this case I would believe you're interested in re.error (https://docs.python.org/3/library/re.html#re.error)?

bugzilla/notifications.cfg
4

Shouldn't this say [krita] rather than [kdevelop]?

The usage of try/except blocks in this case is deliberate and intentional to ensure that any errors in a given entry don't break the script entirely but just cause that entry to fail.

rempt updated this revision to Diff 19679.Sep 20 2017, 8:30 AM

Use the compact variable in the call to summary and move the relevant config to the krita section.

rempt updated this revision to Diff 19680.Sep 20 2017, 8:52 AM

Dmitry said he'd also like to see NeedInfo bugs, so I've changed the onlynew boolean to text. I also think I messed up reading the compact option, but I'm not totally sure... I don't have a way to test the code, so it's all blind typing.

The usage of try/except blocks in this case is deliberate and intentional to ensure that any errors in a given entry don't break the script entirely but just cause that entry to fail.

I'll move this elsewhere as this review is now inactive, though in case someone stumbles upon this comment chain:

While not a practical concern in this very particular case, do note that these blanket clauses will catch exceptions you probably don't want to catch, including base exceptions like KeyboardInterrupt and SystemExit. e.g. ctrl+c and sys.exit() calls.
If this is intentional, then it's good to write a comment about it. If not, something like this might work better:

mylogger = logging.getLogger("mylogger")
...
try:
    ...
except re.error:
    continue  # intentionally ignore regex parse errors
except Exception:
    mylogger.exception("Unexpected exception occurred while processing config sections")  # logging.exception() will append exception info to the log. Potentially sensitive information might be included
    continue
except:
    raise  # Do other stuff here? If not re-raised, could prevent program from exiting properly