LUXROBO/pymodi

View on GitHub

Showing 41 of 43 total issues

File firmware_updater.py has 1435 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import io
import sys
import time
import json
import serial
Severity: Major
Found in modi/util/firmware_updater.py - About 3 days to fix

    File inspection_util.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    import time
    
    import threading as th
    
    
    Severity: Minor
    Found in modi/util/inspection_util.py - About 4 hrs to fix

      File tutorial_util.py has 303 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import os
      import time
      
      from textwrap import fill
      from textwrap import dedent
      Severity: Minor
      Found in modi/util/tutorial_util.py - About 3 hrs to fix

        File usage_util.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import os
        
        from textwrap import fill
        from textwrap import dedent
        
        
        Severity: Minor
        Found in modi/util/usage_util.py - About 2 hrs to fix

          Function parse_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_data(values, data_type: str) -> Tuple:
              data = []
              if data_type == 'int':
                  for value in values:
                      if value >= 0:
          Severity: Minor
          Found in modi/util/message_util.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 update_module_firmware has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def update_module_firmware(self, update_network_base=False):
                  if update_network_base:
                      self.update_network_base = True
                      # Retrieve the network id only and update it accordingly
                      timeout, delay = 3, 0.1
          Severity: Minor
          Found in modi/util/firmware_updater.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 run has 37 lines of code (exceeds 25 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 1 hr to fix

            Function __init_task has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init_task(
                    self, conn_type, verbose, port, network_uuid,
                ):
                    if not conn_type:
                        is_can = not is_network_module_connected() and is_on_pi()
            Severity: Minor
            Found in modi/modi.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 __update_health has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def __update_health(self, message):
                    """ Update information by health message
            
                    :param message: Dictionary format message of the module
                    :type message: Dictionary
            Severity: Minor
            Found in modi/task/exe_task.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 __update_topology has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def __update_topology(self, message):
                    """Update the topology of the connected modules
            
                    :param message: Dictionary format message of the module
                    :return: None
            Severity: Minor
            Found in modi/task/exe_task.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 inspect_button has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def inspect_button(self, button, i, nb_modules):
                    self.print_wrap(
                        """
                        Button module has cliked, double_clicked, pressed, toggled as its
                        property.
            Severity: Minor
            Found in modi/util/inspection_util.py - About 1 hr to fix

              Function run_lesson3 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def run_lesson3(self):
                      led = self.led
                      led.rgb = 0, 0, 0
                      self.clear()
                      self.print_lesson(3, "Controlling modules")
              Severity: Minor
              Found in modi/util/tutorial_util.py - About 1 hr to fix

                Function run_lesson4 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def run_lesson4(self):
                        button = self.button
                        led = self.led
                
                        self.clear()
                Severity: Minor
                Found in modi/util/tutorial_util.py - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          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):
                              return False
                  Severity: Major
                  Found in modi/util/debugging_util.py - About 1 hr to fix

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

                            def __trim_map(self, raw_map: List):
                                """
                                Trims the matrix to get rid of empty spaces, containing zeros only
                                """
                                x, y, w, h = -1, -1, 1, 1
                    Severity: Minor
                    Found in modi/util/topology_util.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 __parse_set_message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __parse_set_message(destination_id: int,
                                                property_type: int,
                                                property_values: Tuple,
                                                property_data_type: int) -> List[str]:
                            """Generate set_property json serialized message
                    Severity: Minor
                    Found in modi/module/output_module/output_module.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

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

                      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 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 __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
                            Severity
                            Category
                            Status
                            Source
                            Language