Search code examples
pythonbug-trackingklocwork

Creating ticket in Bug Tracking system from Klocwork


I know that there is possibility to create a python script to send the data to the Bug Tracking System to create new ticket.

However the problem on my side is that there are fields in the ticket that are mandatory while creating it. For these fields there are more options to choose from. These values should be chose by the user. The problem here is that with the script from the tutorial on Klocwork official pages I can't really choose specific option for the field.

Is there some way to create the ticket with python scripts in more steps (retrieving values for fields, choosing options for fields and only then creating the ticket itself) instead of only clicking on the button which does all the work in one step?

Thank you a lot, Jakub


Solution

  • I work in Klocwork Support and I answered a similar question on the Klocwork support forums as well, which may have also been from you.

    The integration method uses a python script run on the Klocwork server side to push the issue to the Bug Tracking system when the user clicks a button. Currently, there is no way to display additional dialogs or UI to the user when they push an issue to the Bug tracker.

    One possible workaround is to have the user specify this information in a comment on the defect, which can then be read by the python script and used when submitting the issue to the Bug Tracking system. issue.history is an array of StatusHistoryEvent objects that represent each citing status change and/or comment. So you can easily parse the comments by looping through the events:

    for event in issue.history
        text = event.comment
        # parse out the values depending on how you saved them in the comment