kontron/python-ipmi

View on GitHub

Showing 88 of 341 total issues

File picmg.py has 653 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2014  Kontron Europe GmbH
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
Severity: Major
Found in pyipmi/msgs/picmg.py - About 1 day to fix

    File ipmitool.py has 599 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python3
    
    # Copyright (c) 2014  Kontron Europe GmbH
    #
    # This library is free software; you can redistribute it and/or
    Severity: Major
    Found in pyipmi/ipmitool.py - About 1 day to fix

      File hpm.py has 541 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright (c) 2014  Kontron Europe GmbH
      #
      # This library is free software; you can redistribute it and/or
      # modify it under the terms of the GNU Lesser General Public
      # License as published by the Free Software Foundation; either
      Severity: Major
      Found in pyipmi/hpm.py - About 1 day to fix

        File rmcp.py has 508 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Copyright (c) 2018  Kontron Europe GmbH
        #
        # This library is free software; you can redistribute it and/or
        # modify it under the terms of the GNU Lesser General Public
        # License as published by the Free Software Foundation; either
        Severity: Major
        Found in pyipmi/interfaces/rmcp.py - About 1 day to fix

          File sdr.py has 489 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Copyright (c) 2014  Kontron Europe GmbH
          #
          # This library is free software; you can redistribute it and/or
          # modify it under the terms of the GNU Lesser General Public
          # License as published by the Free Software Foundation; either
          Severity: Minor
          Found in pyipmi/sdr.py - About 7 hrs to fix

            File vita.py has 483 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # Copyright (c) 2021  Kontron Europe GmbH
            #
            # This library is free software; you can redistribute it and/or
            # modify it under the terms of the GNU Lesser General Public
            # License as published by the Free Software Foundation; either
            Severity: Minor
            Found in pyipmi/msgs/vita.py - About 7 hrs to fix

              File device_messaging.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # Copyright (c) 2014  Kontron Europe GmbH
              #
              # This library is free software; you can redistribute it and/or
              # modify it under the terms of the GNU Lesser General Public
              # License as published by the Free Software Foundation; either
              Severity: Minor
              Found in pyipmi/msgs/device_messaging.py - About 6 hrs to fix

                Function usage has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                Open

                def usage(toplevel=False):
                    commands = []
                    maxlen = 0
                
                    if toplevel:
                Severity: Minor
                Found in pyipmi/ipmitool.py - About 6 hrs 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 40 (exceeds 5 allowed). Consider refactoring.
                Open

                def main():
                    try:
                        opts, args = getopt.getopt(sys.argv[1:], 't:hvVI:H:U:P:L:o:b:p:r:J')
                    except getopt.GetoptError as err:
                        print(str(err))
                Severity: Minor
                Found in pyipmi/ipmitool.py - About 6 hrs 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

                File picmg.py has 404 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # Copyright (c) 2014  Kontron Europe GmbH
                #
                # This library is free software; you can redistribute it and/or
                # modify it under the terms of the GNU Lesser General Public
                # License as published by the Free Software Foundation; either
                Severity: Minor
                Found in pyipmi/picmg.py - About 5 hrs to fix

                  File constants.py has 381 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # Copyright (c) 2014  Kontron Europe GmbH
                  #
                  # This library is free software; you can redistribute it and/or
                  # modify it under the terms of the GNU Lesser General Public
                  # License as published by the Free Software Foundation; either
                  Severity: Minor
                  Found in pyipmi/msgs/constants.py - About 5 hrs to fix

                    File fru.py has 351 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # Copyright (c) 2014  Kontron Europe GmbH
                    #
                    # This library is free software; you can redistribute it and/or
                    # modify it under the terms of the GNU Lesser General Public
                    # License as published by the Free Software Foundation; either
                    Severity: Minor
                    Found in pyipmi/fru.py - About 4 hrs to fix

                      Hpm has 33 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Hpm(object):
                      
                          @staticmethod
                          def _get_component_count(components):
                              """Return the number of components."""
                      Severity: Minor
                      Found in pyipmi/hpm.py - About 4 hrs to fix

                        Function cmd_fru_print has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def cmd_fru_print(ipmi, args):
                            fru_id = 0
                            print_all = False
                            if len(args) > 0:
                                fru_id = int(args[0])
                        Severity: Minor
                        Found in pyipmi/ipmitool.py - About 4 hrs 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_and_receive has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _send_and_receive(self, target, lun, netfn, cmdid, payload):
                                """Send and receive data using RMCP interface.
                        
                                target:
                                lun:
                        Severity: Minor
                        Found in pyipmi/interfaces/rmcp.py - About 3 hrs 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

                        Picmg has 28 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Picmg(object):
                            def get_picmg_properties(self):
                                return self.send_message_with_name('GetPicmgProperties')
                        
                            def fru_control(self, fru_id, option):
                        Severity: Minor
                        Found in pyipmi/picmg.py - About 3 hrs to fix

                          Function parse_interface_options has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def parse_interface_options(interface_name, options):
                              if options:
                                  options = options.split(',')
                          
                              interface_options = {}
                          Severity: Minor
                          Found in pyipmi/ipmitool.py - About 3 hrs 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

                          File message.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          # Copyright (c) 2014  Kontron Europe GmbH
                          #
                          # This library is free software; you can redistribute it and/or
                          # modify it under the terms of the GNU Lesser General Public
                          # License as published by the Free Software Foundation; either
                          Severity: Minor
                          Found in pyipmi/msgs/message.py - About 3 hrs to fix

                            File emulation.py has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import argparse
                            import logging
                            import os
                            import random
                            import socket
                            Severity: Minor
                            Found in pyipmi/emulation.py - About 2 hrs to fix

                              Function _from_data has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def _from_data(self, data):
                                      buffer = ByteBuffer(data[5:])
                                      # record key bytes
                                      self._common_record_key(buffer.pop_slice(3))
                                      # record body bytes
                              Severity: Major
                              Found in pyipmi/sdr.py - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language