srevinsaju/guiscrcpy

View on GitHub
guiscrcpy/launcher.py

Summary

Maintainability
F
5 days
Test Coverage

File launcher.py has 1048 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3

"""
GUISCRCPY by srevinsaju
Get it on : https://github.com/srevinsaju/guiscrcpy
Severity: Major
Found in guiscrcpy/launcher.py - About 2 days to fix

    Function scan_devices_update_list_view has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def scan_devices_update_list_view(self):
            """
            Scan for new devices; and update the list view
            :return:
            """
    Severity: Minor
    Found in guiscrcpy/launcher.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

    InterfaceGuiscrcpy has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class InterfaceGuiscrcpy(QMainWindow, Ui_MainWindow):
    
        """
        Main class for guiscrcpy object.
        All the processes to spawn to scrcpy are handled here
    Severity: Minor
    Found in guiscrcpy/launcher.py - About 2 hrs to fix

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

          def __init__(
              self,
              config_manager: InterfaceConfig,
              adb: AndroidDebugBridge,
              scrcpy: ScrcpyBridge,
      Severity: Minor
      Found in guiscrcpy/launcher.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 start_act has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def start_act(self):
              """
              Main brain of guiscrcpy; handles what to do when
              :return:
              """
      Severity: Minor
      Found in guiscrcpy/launcher.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 check_devices_status_and_select_first_if_only_one has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_devices_status_and_select_first_if_only_one(self, values_devices_list):
              """
              Checks the devices in the Grid View, and then checks if any device
              is available or offline accordingly display the error message. If
              only one device was detected, automatically select the first device
      Severity: Minor
      Found in guiscrcpy/launcher.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 __init__ has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(
              self,
              config_manager: InterfaceConfig,
              adb: AndroidDebugBridge,
              scrcpy: ScrcpyBridge,
      Severity: Major
      Found in guiscrcpy/launcher.py - About 2 hrs to fix

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

            def create_desktop_shortcut_linux_os(self) -> bool:
                """
                Creates a desktop shortcut for Linux OS
                :return: bool
                """
        Severity: Minor
        Found in guiscrcpy/launcher.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 remove_device_device_view has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def remove_device_device_view(self, identifier: str = "", statuses=()):
                """
                Removes all QListWidgetItems from the device_view for all matching
                identifier
                :param identifier: str
        Severity: Minor
        Found in guiscrcpy/launcher.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 ping_paired_device has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def ping_paired_device(self, device_id=None):
                # update the configuration file first
                if not device_id:
                    _, identifier = self.current_device_identifier()
                    if identifier.count(".") == 3:
        Severity: Minor
        Found in guiscrcpy/launcher.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 start_act has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def start_act(self):
                """
                Main brain of guiscrcpy; handles what to do when
                :return:
                """
        Severity: Minor
        Found in guiscrcpy/launcher.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in guiscrcpy/launcher.py - About 50 mins to fix

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

            def bootstrap(
            Severity: Minor
            Found in guiscrcpy/launcher.py - About 45 mins to fix

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

                  def tcpip_paired_device(self):
                      if self.devices_view.currentItem():
                          _, identifier = self.current_device_identifier()
                      else:
                          identifier = ""
              Severity: Minor
              Found in guiscrcpy/launcher.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 0
              Severity: Major
              Found in guiscrcpy/launcher.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return device_id, more_devices, _stat
                Severity: Major
                Found in guiscrcpy/launcher.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return 0
                  Severity: Major
                  Found in guiscrcpy/launcher.py - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status