LUXROBO/pymodi

View on GitHub
modi/util/firmware_updater.py

Summary

Maintainability
F
4 days
Test Coverage

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

    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 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 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 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 __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 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 __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

                    There are no issues that match your filters.

                    Category
                    Status