LUXROBO/pymodi

View on GitHub

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

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

                            self.cursor.y = h - h * sin(radians(self.gyro.roll))
                    Severity: Minor
                    Found in examples/creation_examples/brush.py and 1 other location - About 35 mins to fix
                    examples/creation_examples/brush.py on lines 19..19

                    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 33.

                    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

                    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

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

                            self.cursor.x = w - w * sin(radians(self.gyro.yaw))
                    Severity: Minor
                    Found in examples/creation_examples/brush.py and 1 other location - About 35 mins to fix
                    examples/creation_examples/brush.py on lines 18..18

                    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 33.

                    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

                    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

                      Severity
                      Category
                      Status
                      Source
                      Language