LUXROBO/pymodi

View on GitHub

Showing 41 of 43 total issues

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

    def get_firmware_command(self, module_id: int, rot_stype: int,
Severity: Minor
Found in modi/util/firmware_updater.py - About 45 mins to fix

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

            def __update_map(self, module_id: int, x: int, y: int, prev_id: int,
    Severity: Minor
    Found in modi/util/topology_util.py - About 45 mins to fix

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

          def send_firmware_command(self, oper_type: str, module_id: int,
      Severity: Minor
      Found in modi/util/firmware_updater.py - About 45 mins to fix

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

            def __find_modi_device(self):
                scanner = pexpect.spawn('sudo hcitool lescan')
                init_time = time.time()
                devices = []
                while time.time() - init_time < 1:
        Severity: Minor
        Found in modi/task/ble_task/ble_task_rpi.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 __send_pkt has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __send_pkt(self, pkt, wait=True, timeout=None, continuous=False):
        Severity: Minor
        Found in modi/util/firmware_updater.py - About 35 mins to fix

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

              def send_firmware_data(self, module_id: int, seq_num: int, bin_data: bytes,
          Severity: Minor
          Found in modi/util/firmware_updater.py - About 35 mins to fix

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

                def __add_new_module(
            Severity: Minor
            Found in modi/task/exe_task.py - About 35 mins to fix

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

                  def send_firmware_data(self, module_id: int, seq_num: int, bin_data: bytes,
              Severity: Minor
              Found in modi/util/firmware_updater.py - About 35 mins to fix

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

                    def __init_task(
                Severity: Minor
                Found in modi/modi.py - About 35 mins to fix

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

                      def __write_chunk(self, chunk, curr_seq, total_seq, manager):
                  Severity: Minor
                  Found in modi/util/firmware_updater.py - About 35 mins to fix

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

                        def open_conn(self) -> None:
                            """ Open serial port
                    
                            :return: None
                            """
                    Severity: Minor
                    Found in modi/task/ser_task.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 __ble_read has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __ble_read(self):
                            """
                            handle -- integer, characteristic read handle the data was received on
                            value -- bytearray, the data returned in the notification
                            """
                    Severity: Minor
                    Found in modi/task/ble_task/ble_task_rpi.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 __compose_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def __compose_line(self, module_id, padding, print_id):
                                line = ""
                                if not module_id:
                                    line += " " * padding
                                else:
                    Severity: Minor
                    Found in modi/util/topology_util.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 __check_modules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def __check_modules(bundle):
                        module_names = [type(module).__name__ for module in bundle.modules]
                        expected_names = ["Button", "Dial", "Led", "Speaker", "Display"]
                        if len(module_names) != len(expected_names):
                            return False
                    Severity: Minor
                    Found in modi/util/strange_util.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 im(mod_path).BleTask(verbose, network_uuid)
                    Severity: Major
                    Found in modi/modi.py - About 30 mins to fix

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

                      def initialize(display: Display, led: Led, speaker: Speaker,
                                     dial: Dial) -> int:
                          """Initialize the movment of the ball
                      
                          :param display: Display module
                      Severity: Minor
                      Found in modi/util/strange_util.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 __encode_bytes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def __encode_bytes(byte_data: Tuple):
                          idx = 0
                          data = bytearray(len(byte_data))
                          while idx < len(byte_data):
                              if not byte_data[idx]:
                      Severity: Minor
                      Found in modi/util/message_util.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def run(self):
                              width, height = 930, 790
                              window = Tk()
                              window.title(f"GUI Debugger for PyMODI (v{modi.__version__})")
                              window.geometry(f"{width}x{height}")
                      Severity: Minor
                      Found in modi/util/debugging_util.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 __query_log has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __query_log(self, line: str) -> bool:
                              if ('recv' not in line and 'send' not in line) or \
                                  (self.__curr_module and str(self.__curr_module.id) not in line
                                      and self.__curr_module.module_type != 'network') \
                                      or (self.__curr_cmd and f'"c":{self.__curr_cmd},' not in line):
                      Severity: Minor
                      Found in modi/util/debugging_util.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 check_option has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def check_option(*options):
                          for o, a in opts:
                              if o in options:
                                  return a if a else True
                          return False
                      Severity: Minor
                      Found in modi/__main__.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