srevinsaju/guiscrcpy

View on GitHub

Showing 67 of 67 total issues

File style.py has 1354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
GUISCRCPY by srevinsaju
Get it on : https://github.com/srevinsaju/guiscrcpy
Licensed under GNU Public License

Severity: Major
Found in guiscrcpy/theme/style.py - About 3 days to fix

    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

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

          @staticmethod
          def make_config():
              if os.getenv("XDG_CONFIG_HOME") is None:
                  path = os.path.expanduser("~/.config/guiscrcpy/")
              else:
      Severity: Major
      Found in guiscrcpy/platform/linux.py and 1 other location - About 1 day to fix
      guiscrcpy/platform/darwin.py on lines 33..47

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

      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

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

          @staticmethod
          def make_config():
              if os.getenv("XDG_CONFIG_HOME") is None:
                  path = os.path.expanduser("~/.config/guiscrcpy/")
              else:
      Severity: Major
      Found in guiscrcpy/platform/darwin.py and 1 other location - About 1 day to fix
      guiscrcpy/platform/linux.py on lines 46..60

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

      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

      File desktop_shortcut.py has 443 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env/python\n
      # flake8: noqa
      def desktop_device_shortcut_svg():
          a = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <svg
      Severity: Minor
      Found in guiscrcpy/theme/desktop_shortcut.py - About 6 hrs to fix

        Function check_existence has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

        def check_existence(paths, filename="", directory=True, path=False):
            for i in paths:
                j = os.path.expanduser(i)
                if os.path.exists(j):  # directory exists
                    if directory and os.path.isdir(j):
        Severity: Minor
        Found in guiscrcpy/lib/utils.py - About 6 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

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

                if self.config["scrcpy"] is None:
                    scrcpy_path = shutil.which("scrcpy")
                    self.config["scrcpy"] = scrcpy_path
                else:
                    _scrcpy_path = self.config["scrcpy"]
        Severity: Major
        Found in guiscrcpy/lib/config.py and 1 other location - About 5 hrs to fix
        guiscrcpy/lib/config.py on lines 72..83

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

        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

                if self.config["adb"] is None:
                    adb_path = shutil.which("adb")
                    self.config["adb"] = adb_path
                else:
                    _adb_path = self.config["adb"]
        Severity: Major
        Found in guiscrcpy/lib/config.py and 1 other location - About 5 hrs to fix
        guiscrcpy/lib/config.py on lines 85..96

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

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

        Function connect has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def connect(self):
                try:
                    ip = self.listView.currentItem().text()
                except AttributeError:
                    # The IP Address in the ListView has precedence over the IP address
        Severity: Minor
        Found in guiscrcpy/ux/network.py - About 3 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

        File cli.py has 309 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import os
        import platform
        import sys
        import traceback
        
        
        Severity: Minor
        Found in guiscrcpy/cli.py - About 3 hrs to fix

          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 __init__ has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def __init__(self, ux_wrapper=None, frame=False, always_on_top=True):
                    """
                    Swipe UI
                    :param ux_wrapper: UXMapper type object
                    :param frame: bool
            Severity: Major
            Found in guiscrcpy/ux/swipe.py - About 2 hrs to fix

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

                  def complete(self):
                      x = []
                      for i in self.checkboxes:
                          if i.isChecked():
                              box = self.checkboxes[i]
              Severity: Minor
              Found in guiscrcpy/ux/settings.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

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

                  def fullscreen(self):
                      if self.has_modules:
                          scrcpy_window = getWindowsWithTitle("scrcpy")[0]
                          scrcpy_window.focus()
                          auto.hotkey("alt", "f")
              Severity: Major
              Found in guiscrcpy/lib/toolkit.py and 1 other location - About 2 hrs to fix
              guiscrcpy/lib/toolkit.py on lines 133..139

              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

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

                  def copy_devpc(self):
                      if self.has_modules:
                          scrcpywindow = getWindowsWithTitle("scrcpy")[0]
                          scrcpywindow.focus()
                          auto.hotkey("alt", "c")
              Severity: Major
              Found in guiscrcpy/lib/toolkit.py and 1 other location - About 2 hrs to fix
              guiscrcpy/lib/toolkit.py on lines 199..205

              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

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