kontron/python-ipmi

View on GitHub

Showing 341 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def encode(self):
                """Encode the header."""
                data = array('B')
                data.append(self.rs_sa)
                data.append(self.netfn << 2 | self.rs_lun)
        Severity: Major
        Found in pyipmi/interfaces/ipmb.py and 1 other location - About 1 day to fix
        pyipmi/interfaces/ipmb.py on lines 93..102

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 132.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def encode(self):
                """Encode the header."""
                data = array('B')
                data.append(self.rq_sa)
                data.append(self.netfn << 2 | self.rq_lun)
        Severity: Major
        Found in pyipmi/interfaces/ipmb.py and 1 other location - About 1 day to fix
        pyipmi/interfaces/ipmb.py on lines 65..74

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 132.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      if capabilities & THRESHOLD_MASK == THRESHOLD_IS_NOT_SUPPORTED:
                          self.capabilities.append('threshold_not_supported')
                      elif capabilities & THRESHOLD_MASK == THRESHOLD_IS_READABLE:
                          self.capabilities.append('threshold_readable')
                      elif capabilities & THRESHOLD_MASK == THRESHOLD_IS_READ_AND_SETTABLE:
              Severity: Major
              Found in pyipmi/sdr.py and 1 other location - About 7 hrs to fix
              pyipmi/sdr.py on lines 359..366

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 111.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      if capabilities & HYSTERESIS_MASK == HYSTERESIS_IS_NOT_SUPPORTED:
                          self.capabilities.append('hysteresis_not_supported')
                      elif capabilities & HYSTERESIS_MASK == HYSTERESIS_IS_READABLE:
                          self.capabilities.append('hysteresis_readable')
                      elif capabilities & HYSTERESIS_MASK == HYSTERESIS_IS_READ_AND_SETTABLE:
              Severity: Major
              Found in pyipmi/sdr.py and 1 other location - About 7 hrs to fix
              pyipmi/sdr.py on lines 373..380

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 111.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  def send_and_receive(self, req):
                      """Interface function to send and receive an IPMI message.
              
                      target: IPMI target
                      req: IPMI message request
              Severity: Major
              Found in pyipmi/interfaces/ipmbdev.py and 1 other location - About 6 hrs to fix
              pyipmi/interfaces/aardvark.py on lines 204..224

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 105.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  def send_and_receive(self, req):
                      """Interface function to send and receive an IPMI message.
              
                      target: IPMI target
                      req: IPMI message request
              Severity: Major
              Found in pyipmi/interfaces/aardvark.py and 1 other location - About 6 hrs to fix
              pyipmi/interfaces/ipmbdev.py on lines 152..172

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 105.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def is_ipmc_accessible(self, target):
                          header = IpmbHeaderReq()
                          header.netfn = 6
                          header.rs_lun = 0
                          header.rs_sa = target.ipmb_address
                  Severity: Major
                  Found in pyipmi/interfaces/ipmbdev.py and 1 other location - About 5 hrs to fix
                  pyipmi/interfaces/aardvark.py on lines 86..97

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 91.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def is_ipmc_accessible(self, target):
                          header = IpmbHeaderReq()
                          header.netfn = 6
                          header.rs_lun = 0
                          header.rs_sa = target.ipmb_address
                  Severity: Major
                  Found in pyipmi/interfaces/aardvark.py and 1 other location - About 5 hrs to fix
                  pyipmi/interfaces/ipmbdev.py on lines 33..44

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 91.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            Bitfield('set_mask', 1,
                                     Bitfield.Bit('lnc', 1, default=0),
                                     Bitfield.Bit('lcr', 1, default=0),
                                     Bitfield.Bit('lnr', 1, default=0),
                                     Bitfield.Bit('unc', 1, default=0),
                    Severity: Major
                    Found in pyipmi/msgs/sensor.py and 1 other location - About 5 hrs to fix
                    pyipmi/msgs/sensor.py on lines 110..117

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 86.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language