srevinsaju/guiscrcpy

View on GitHub

Showing 67 of 67 total issues

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

    def reorient_portrait(self):
        logging.debug("Passing REORIENT [POTRAIT]")
        self.adb.shell(
            "settings put system accelerometer_rotation 0", device_id=self.deviceId
        )
Severity: Major
Found in guiscrcpy/lib/toolkit.py and 1 other location - About 1 hr to fix
guiscrcpy/lib/toolkit.py on lines 176..181

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

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

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

    def reorient_landscape(self):
        logging.debug("Passing REORIENT [LANDSCAPE]")
        self.adb.shell(
            "settings put system accelerometer_rotation 0", device_id=self.deviceId
        )
Severity: Major
Found in guiscrcpy/lib/toolkit.py and 1 other location - About 1 hr to fix
guiscrcpy/lib/toolkit.py on lines 169..174

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

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 mapper has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def mapper(device_id=None, reset=False):
    """Run the guiscrcpy mapper"""
    config_manager = InterfaceConfig()
    config = config_manager.get_config()
    mapper_cfg_path = os.path.join(
Severity: Minor
Found in guiscrcpy/cli.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 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 build_user_interface has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def build_user_interface(self):
        self.label = QtWidgets.QLabel(self)
        self.drawing = False
        self.widget = QtWidgets.QWidget(self)
        self.widget.setGeometry(QtCore.QRect(0, 0, 351, 34))
Severity: Minor
Found in guiscrcpy/lib/mapper/ux.py - About 1 hr to fix

    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 quit_window has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def quit_window(self):
            for instance in self.parent.child_windows:  # noqa
                # We are checking for any more windows running before killing
                # the main window. self.child_windows has the list of all
                # objects spawned by the main window ui
    Severity: Minor
    Found in guiscrcpy/ux/toolkit.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 validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate(self):
            # check scrcpy and adb are not None, else replace it with original
            # values
            if os.getenv("APPIMAGE") is not None:
                # no need further configuration for adb, scrcpy and scrcpy_server
    Severity: Minor
    Found in guiscrcpy/lib/config.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 quit_window has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def quit_window(self):
            for instance in self.parent.child_windows:  # noqa
                # We are checking for any more windows running before killing
                # the main window. self.child_windows has the list of all
                # objects spawned by the main window ui
    Severity: Minor
    Found in guiscrcpy/ux/panel.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

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

        def get_scrcpy(self):
            if self.config["scrcpy"] is not None:
                return self.config["scrcpy"]
            else:
                return None
    Severity: Major
    Found in guiscrcpy/lib/config.py and 1 other location - About 1 hr to fix
    guiscrcpy/lib/config.py on lines 120..124

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

    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 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 get_dimensions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_dimensions(self, device_id=None):
            shell_adb = _get_dimension_raw_noexcept(path=self.path, device_id=device_id)
            try:
                if shell_adb.wait(timeout=3) != 0:
                    self.logger.warning(
    Severity: Minor
    Found in guiscrcpy/lib/bridge/adb.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 create_desktop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_desktop(desktop_file=None, desktop_file_name="guiscrcpy.desktop"):
            """
            Create Desktop filename for Linux in ~/.local level
            :return:
            """
    Severity: Minor
    Found in guiscrcpy/platform/linux.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

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

        def get_adb(self):
            if self.config["adb"] is not None:
                return self.config["adb"]
            else:
                return None
    Severity: Major
    Found in guiscrcpy/lib/config.py and 1 other location - About 1 hr to fix
    guiscrcpy/lib/config.py on lines 114..118

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

    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 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 cli has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def cli(
          ctx: Context,
          hide_wm_frame: bool = True,
          aot: bool = True,
          theme: str = "Breeze",
      Severity: Minor
      Found in guiscrcpy/cli.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 is_running has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def is_running(process_name):
          if psutil_present:
              # Iterate over the all the running process
              for proc in psutil.process_iter():
                  try:
      Severity: Minor
      Found in guiscrcpy/lib/process.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, device_id=None):
              if device_id is None:
                  command = [self.get_path()]
              else:
                  command = [self.get_path(), device_id]
      Severity: Minor
      Found in guiscrcpy/lib/bridge/audio/sndcpy.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 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

                this.typeDelay = options.typeDelay
                    || parseFloat(this.container.getAttribute(`${this.pfx}-typeDelay`)) || 90;
        Severity: Major
        Found in www/js/termynal.js and 4 other locations - About 50 mins to fix
        www/js/termynal.js on lines 33..34
        www/js/termynal.js on lines 37..38
        www/js/termynal.js on lines 39..40
        www/js/termynal.js on lines 43..44

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

        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

        Severity
        Category
        Status
        Source
        Language