christoph2/pyBDM

View on GitHub

Showing 17 of 83 total issues

File CPU12.py has 1477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

##!/usr/bin/env python
# -*- coding: utf-8 -*-

__version__="0.1.0"

Severity: Major
Found in pyBDM/s12/CPU12.py - About 3 days to fix

    Function disasm has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

    def disasm(addr, memory):
        decoder = PostbyteDecoder()
        pc = addr
        op = memory.getByte(pc)
        mnemonic, _, mode, size = opcodeMapPage1.get(op)
    Severity: Minor
    Found in pyBDM/s12/CPU12.py - About 1 day 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

    BDMBase has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BDMBase(object):
        """ .. class:: BDM
    
            BDM Communication base class.
        """
    Severity: Minor
    Found in pyBDM/bdm.py - About 6 hrs to fix

      Function dis2 has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      def dis2(addressFrom, addressTo, memory):
          pc = addressFrom
          while pc <= addressTo:
              operand = ''
              deco = preDecode(pc, memory)
      Severity: Minor
      Found in pyBDM/s12/CPU12.py - About 5 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 probeHC12 has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

      def probeHC12(port):
          couldBeDG128 = False
      
          port.logger.info("Probing for HC12 derivate.")
          initRM, initRE, misc = port.readByte(INITRM), port.readByte(INITRE), port.readByte(MISC)
      Severity: Minor
      Found in pyBDM/s12/autoprobe.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

      File bdm.py has 357 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      
      __version__ = "0.1.0"
      
      
      Severity: Minor
      Found in pyBDM/bdm.py - About 4 hrs to fix

        Function write has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def write(self, data):
                startTime = 0
                timeSpan = 0
                waitCTSToClearTimeout = self.ctsRtsControl and 0.100 or 0.02
        
        
        Severity: Minor
        Found in pyBDM/kevinro.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 pybdm_hexdump.py has 290 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        Severity: Minor
        Found in tools/pybdm_hexdump.py - About 2 hrs to fix

          Function decodeMove has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def decodeMove(deco):
              operand = ""
              mode = deco.mode
              bytes_ = deco.byte_
              if 0x08 <= deco.opcode <= 0x0d:     # MOVB
          Severity: Minor
          Found in pyBDM/s12/CPU12.py - About 2 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 testFormatParser has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          Severity: Minor
          Found in tools/pybdm_hexdump.py - About 1 hr 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 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Severity: Minor
          Found in tools/pybdm_hexdump.py - About 1 hr to fix

            Function decode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def decode(cls, postbyte):
                    if postbyte in cls.cache:
                        return cls.cache.get(postbyte)
                    else:
                        for decoding, masks in cls.DECODINGs:
            Severity: Minor
            Found in pyBDM/s12/CPU12.py - About 1 hr 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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, opcode, mnemonic, mode, totalSize, page2, bytes_, rawBytes):
            Severity: Major
            Found in pyBDM/s12/CPU12.py - About 50 mins to fix

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

                  def __init__(self, num, baudrate, bytesize = serial.EIGHTBITS, parity = serial.PARITY_NONE, stopbits = serial.STOPBITS_ONE,
              Severity: Minor
              Found in pyBDM/serialport.py - About 45 mins to fix

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

                    def __init__(self, port):
                        self._port = port
                        self.logger = Logger()
                        if hasattr(self, '__REGISTERS8__'):
                            for name, reg in self.__REGISTERS8__:
                Severity: Minor
                Found in pyBDM/module.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 preDecode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def preDecode(addr, mem):
                    """Figures out the total length of bytes following."""
                
                    decoder = PostbyteDecoder()
                    if mem.getByte(addr + 0) == PAGE2:
                Severity: Minor
                Found in pyBDM/s12/CPU12.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 parseFormat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                Severity: Minor
                Found in tools/pybdm_hexdump.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