kontron/python-ipmi

View on GitHub

Showing 88 of 341 total issues

Function _send_and_receive has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _send_and_receive(self, target, lun, netfn, cmdid, payload):
Severity: Minor
Found in pyipmi/interfaces/aardvark.py - About 35 mins to fix

    Function send_platform_event has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def send_platform_event(self, sensor_type, sensor_number, event_type,
    Severity: Minor
    Found in pyipmi/sensor.py - About 35 mins to fix

      Function i2c_read has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def i2c_read(self, bus_type, bus_id, channel, address, count):
      Severity: Minor
      Found in pyipmi/bmc.py - About 35 mins to fix

        Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, slave_address=0x81, host_target_address=0x20,
        Severity: Minor
        Found in pyipmi/interfaces/rmcp.py - About 35 mins to fix

          Function partial_add_sdr has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def partial_add_sdr(self, reservation_id, record_id,
          Severity: Minor
          Found in pyipmi/sdr.py - About 35 mins to fix

            Function send_channel_power has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def send_channel_power(self, channel, enable, current_limit, primary_pm=1, backup_pm=0):
            Severity: Minor
            Found in pyipmi/picmg.py - About 35 mins to fix

              Function i2c_write has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def i2c_write(self, bus_type, bus_id, channel, address, data):
              Severity: Minor
              Found in pyipmi/bmc.py - About 35 mins to fix

                Function _clear_repository has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _clear_repository(reserve_fn, clear_fn, ctrl, retry, reservation):
                Severity: Minor
                Found in pyipmi/helper.py - About 35 mins to fix

                  Function _send_and_receive has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def _send_and_receive(self, target, lun, netfn, cmdid, payload):
                  Severity: Minor
                  Found in pyipmi/interfaces/ipmbdev.py - About 35 mins to fix

                    Function _decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _decode(self, data):
                            """Decode the bytestring message."""
                            if not hasattr(self, '__fields__'):
                                return
                    
                    
                    Severity: Minor
                    Found in pyipmi/msgs/message.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function preparation_stage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def preparation_stage(self, image):
                            ####################################################
                            # match device ID, manfuacturer ID, etc.
                            device_id = self.get_device_id()
                    
                    
                    Severity: Minor
                    Found in pyipmi/hpm.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function boot_options_to_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def boot_options_to_data(boot_device, boot_mode, boot_persistency):
                        """
                        Convert a boot mode (string), boot device (string) and boot persistency (bool)
                        into a `SetSystemBootOptions(BOOT_PARAMETER_BOOT_FLAGS)` request data.
                        """
                    Severity: Minor
                    Found in pyipmi/chassis.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function from_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def from_data(component_id, data):
                            if isinstance(data, str):
                                data = [ord(c) for c in data]
                    
                            if component_id is PROPERTY_GENERAL_PROPERTIES:
                    Severity: Minor
                    Found in pyipmi/hpm.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function send_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def send_message(self, req, retry=3):
                            req.target = self.target
                            req.requester = self.requester
                            rsp = None
                    
                    
                    Severity: Minor
                    Found in pyipmi/__init__.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function convert_sensor_raw_to_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def convert_sensor_raw_to_value(self, raw):
                            if raw is None:
                                return None
                            fmt = self.analog_data_format
                            if (fmt == self.DATA_FMT_1S_COMPLEMENT):
                    Severity: Minor
                    Found in pyipmi/sdr.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function _from_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _from_response(self, rsp):
                            self.device_id = rsp.device_id
                            self.revision = rsp.device_revision.device_revision
                            self.provides_sdrs = bool(rsp.device_revision.provides_device_sdrs)
                            self.available = bool(rsp.firmware_revision.device_available)
                    Severity: Minor
                    Found in pyipmi/bmc.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function to_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def to_request(self, req):
                            req.fru_id = self.fru_id
                            req.led_id = self.led_id
                            req.color = self.override_color
                    
                    
                    Severity: Minor
                    Found in pyipmi/picmg.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Avoid too many return statements within this function.
                    Open

                                return ComponentPropertyDeferredVersion(data)
                    Severity: Major
                    Found in pyipmi/hpm.py - About 30 mins to fix

                      Function get_command_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_command_list():
                          data = list()
                          Command = namedtuple('Command', ['netfn', 'cmdid', 'grpext', 'name'])
                      
                          od = OrderedDict(sorted(DEFAULT_REGISTRY.registry.items()))
                      Severity: Minor
                      Found in bin/supported_cmds.py - About 25 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function _receive_raw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _receive_raw(self, header):
                              start_time = time.time()
                              rsp_received = False
                              poll_returned_no_data = False
                              while not rsp_received:
                      Severity: Minor
                      Found in pyipmi/interfaces/ipmbdev.py - About 25 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Severity
                      Category
                      Status
                      Source
                      Language