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 ( d4663b...83e50d )
by P.R.
02:57
created

RequestNodeActionMessage.__init__()   A

Complexity

Conditions 1

Size

Total Lines 54

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 54
rs 9.6716
ccs 0
cts 9
cp 0
crap 2

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
from enarksh.message.Message import Message
0 ignored issues
show
Bug introduced by
The name message does not seem to exist in module enarksh.
Loading history...
Configuration introduced by
The import enarksh.message.Message could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
9
from enarksh.message.MessageController import MessageController
0 ignored issues
show
Bug introduced by
The name message does not seem to exist in module enarksh.
Loading history...
Configuration introduced by
The import enarksh.message.MessageController could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
10
11
12
class RequestNodeActionMessage(Message):
13
    """
14
    Message type for requesting a node action.
15
    """
16
    MESSAGE_TYPE = 'controller:RequestNodeActionMessage'
17
    """
18
    The message type.
19
20
    :type: str
21
    """
22
23
    # ------------------------------------------------------------------------------------------------------------------
24
    def __init__(self, sch_id, rnd_id, act_id, usr_login, mail_on_completion, mail_on_error):
25
        """
26
        Object constructor.
27
28
        :param int sch_id: The ID of the schedule.
29
        :param int rnd_id: The ID of the run node.
30
        :param int act_id: The ID of the requested action.
31
        :param str usr_login: The name of the user who has requested the node action.
32
        :param bool mail_on_completion: If True the user wants to receive a mail when the schedule has completed.
33
        :param bool mail_on_error: If True the user wants to receive a mail when an error occurs.
34
        """
35
        Message.__init__(self, RequestNodeActionMessage.MESSAGE_TYPE)
36
37
        self.sch_id = sch_id
38
        """
39
        The ID of the schedule.
40
41
        :type: int
42
        """
43
44
        self.rnd_id = rnd_id
45
        """
46
        The ID of the run node.
47
48
        :type: int
49
        """
50
51
        self.act_id = act_id
52
        """
53
        The ID of the requested action.
54
55
        :type: int
56
        """
57
58
        self.usr_login = usr_login
59
        """
60
        The name of the user who has requested the node action.
61
62
        :type: int
63
        """
64
65
        self.mail_on_completion = mail_on_completion
66
        """
67
        If True the user wants to receive a mail when the schedule has completed.
68
69
        :type: bool
70
        """
71
72
        self.mail_on_error = mail_on_error
73
        """
74
        If True the user wants to receive a mail when an error occurs.
75
76
        :type: bool
77
        """
78
79
    # ------------------------------------------------------------------------------------------------------------------
80
    @staticmethod
81
    def create_from_json(message):
82
        """
83
        Object constructor using JSON encoded message.
84
85
        :param * message: The message.
86
87
        :rtype: enarksh.controller.message.RequestPossibleNodeActionsMessage.RequestPossibleNodeActionsMessage
88
        """
89
        return RequestNodeActionMessage(int(message['sch_id']),
90
                                        int(message['rnd_id']),
91
                                        int(message['act_id']),
92
                                        message['usr_login'],
93
                                        bool(message['mail_on_completion']),
94
                                        bool(message['mail_on_error']))
95
96
    # ------------------------------------------------------------------------------------------------------------------
97
    def send_message(self, end_point):
98
        """
99
        Sends the message to an end point.
100
101
        :param str end_point: The end point.
102
103
        :rtype: None
104
        """
105
        self.message_controller.send_message(end_point, self)
0 ignored issues
show
Bug introduced by
The Instance of RequestNodeActionMessage does not seem to have a member named message_controller.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
106
107
108
# ----------------------------------------------------------------------------------------------------------------------
109
MessageController.register_json_message_creator(RequestNodeActionMessage.MESSAGE_TYPE,
110
                                                RequestNodeActionMessage.create_from_json)
111