kontron/python-ipmi

View on GitHub

Showing 88 of 341 total issues

Function set_user_access has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def set_user_access(self, userid, ipmi_msg, link_auth, callback_only,
Severity: Major
Found in pyipmi/messaging.py - About 1 hr to fix

    Function get_sdr_chunk_helper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_sdr_chunk_helper(send_fn, req, reserve_fn, retry=5):
    
        while True:
            retry -= 1
            if retry == 0:
    Severity: Minor
    Found in pyipmi/helper.py - About 55 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 __str__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def __str__(self):
            string = '[flags '
            string += self.local_state_available and ' LOCAL_STATE' or ''
            string += self.override_enabled and ' OVR_EN' or ''
            string += self.lamp_test_enabled and ' LAMP_TEST_EN' or ''
    Severity: Minor
    Found in pyipmi/picmg.py - About 55 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 _build_ipmitool_target has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _build_ipmitool_target(target):
            cmd = ''
            if target is None:
                return ''
            if target.routing is not None:
    Severity: Minor
    Found in pyipmi/interfaces/ipmitool.py - About 55 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 register_class has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def register_class(self, cls):
            # some sanity checks
            # (1) class name has to end in Req or Rsp
            if cls.__name__[-3:] not in ('Req', 'Rsp'):
                raise DescriptionError('Class name has to end in Req or Rsp')
    Severity: Minor
    Found in pyipmi/msgs/registry.py - About 55 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 get_component_properties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_component_properties(self, component_id):
            properties = []
            for p in (PROPERTY_GENERAL_PROPERTIES, PROPERTY_CURRENT_VERSION,
                      PROPERTY_DESCRIPTION_STRING, PROPERTY_ROLLBACK_VERSION,
                      PROPERTY_DEFERRED_VERSION):
    Severity: Minor
    Found in pyipmi/hpm.py - About 45 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 deeply nested control flow statements.
    Open

                                if not rx_data:
                                    # the forwarded reply is expected in the next packet
                                    # so we do not increment the retry counter as
                                    # it's not really a retry
                                    continue
    Severity: Major
    Found in pyipmi/interfaces/rmcp.py - About 45 mins to fix

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

          def __init__(self, slave_address=0x20, port=0, serial_number=None,
      Severity: Minor
      Found in pyipmi/interfaces/aardvark.py - About 45 mins to fix

        Function encode_send_message has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def encode_send_message(payload, rq_sa, rs_sa, channel, seq, tracking=1):
        Severity: Minor
        Found in pyipmi/interfaces/ipmb.py - About 45 mins to fix

          Function i2c_write_read has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function convert_sensor_value_to_raw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def convert_sensor_value_to_raw(self, value):
                    linearization = self.linearization & 0x7f
            
                    if linearization is not L_LINEAR:
                        raise NotImplementedError()
            Severity: Minor
            Found in pyipmi/sdr.py - About 45 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_rsp_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _from_rsp_data(self, data):
                    support = []
                    cap = data[0]
            
                    if cap & self.ROLLBACK_SUPPORT_MASK == 0:
            Severity: Minor
            Found in pyipmi/hpm.py - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _from_response(self, rsp):
                    self.channel = rsp.channel_number
                    self.auth_types = []
            
                    self.ipmi_1_5 = False
            Severity: Minor
            Found in pyipmi/messaging.py - About 45 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 main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def main(args=None):
                parser = argparse.ArgumentParser(description="IPMI server emulation.")
                parser.add_argument("-p", "--port", type=int, dest="port", help="RMCP port", default=623)
                parser.add_argument("-c", "--config", type=str, dest="config", help="Config file")
                parser.add_argument(
            Severity: Minor
            Found in pyipmi/emulation.py - About 45 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 _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_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 get_lan_config_param has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def get_lan_config_param(self, channel=0, parameter_selector=0,
                Severity: Minor
                Found in pyipmi/lan.py - About 35 mins to fix

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

                      def __init__(self, rsp=None, fru_id=None, led_id=None, color=None,
                  Severity: Minor
                  Found in pyipmi/picmg.py - About 35 mins to fix

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

                        def create(self, netfn, cmdid, group_extension, *args, **kwargs):
                    Severity: Minor
                    Found in pyipmi/msgs/registry.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
                        Severity
                        Category
                        Status
                        Source
                        Language