GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( fac2c4...4a4d5a )
by P.R.
03:39
created

NodeActionMessageWebEventHandler.handle()   B

Complexity

Conditions 2

Size

Total Lines 36

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 36
ccs 0
cts 12
cp 0
crap 6
rs 8.8571
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
import sys
9
import traceback
10
11
from enarksh.DataLayer import DataLayer
12
from enarksh.controller.event_handler.NodeActionMessageBaseEventHandler import NodeActionMessageBaseEventHandler
13
14
15
class NodeActionMessageWebEventHandler(NodeActionMessageBaseEventHandler):
16
    """
17
    An event handler for a NodeActionWebMessage received events.
18
    """
19
20
    # ------------------------------------------------------------------------------------------------------------------
21
    @staticmethod
22
    def handle(_event, message, controller):
23
        """
24
        Handles a NodeActionWebMessage received event.
25
26
        :param * _event: Not used.
27
        :param enarksh.controller.message.NodeActionWebMessage.NodeActionWebMessage message: The message.
28
        :param enarksh.controller.Controller.Controller controller: The controller.
29
        """
30
        del _event
31
32
        # Compose a response message for the web interface.
33
        response = {'ret':     0,
34
                    'new_run': 0,
35
                    'message': 'OK'}
36
37
        try:
38
            NodeActionMessageBaseEventHandler.base_handle(controller,
39
                                                          response,
40
                                                          message.sch_id,
41
                                                          message.rnd_id,
42
                                                          message.act_id,
43
                                                          message.usr_login,
44
                                                          message.mail_on_completion,
45
                                                          message.mail_on_error)
46
        except Exception as exception:
1 ignored issue
show
Best Practice introduced by
Catching very general exceptions such as Exception is usually not recommended.

Generally, you would want to handle very specific errors in the exception handler. This ensure that you do not hide other types of errors which should be fixed.

So, unless you specifically plan to handle any error, consider adding a more specific exception.

Loading history...
47
            print(exception, file=sys.stderr)
48
            traceback.print_exc(file=sys.stderr)
49
50
            response['ret'] = -1
51
            response['message'] = 'Internal error'
52
53
            DataLayer.rollback()
54
55
        # Send the message to the web interface.
56
        controller.message_controller.send_message('lockstep', response, True)
57
58
# ----------------------------------------------------------------------------------------------------------------------
59