ssokolow/quicktile

View on GitHub

Showing 197 of 198 total issues

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

        self.assertEqual(test_region.find_monitor_for(
            Rectangle(3300, 640, 1, 1)),
            Rectangle(x=3200, y=56, width=1280, height=1024))
Severity: Major
Found in tests/test_util.py and 3 other locations - About 1 hr to fix
tests/test_util.py on lines 632..634
tests/test_util.py on lines 635..637
tests/test_util.py on lines 901..903

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

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 4 locations. Consider refactoring.
Open

        self.assertEqual(test_region.find_monitor_for(
            Rectangle(3000, 640, 1, 1)),
            Rectangle(x=1280, y=0, width=1920, height=1080))
Severity: Major
Found in tests/test_util.py and 3 other locations - About 1 hr to fix
tests/test_util.py on lines 632..634
tests/test_util.py on lines 638..640
tests/test_util.py on lines 901..903

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

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 4 locations. Consider refactoring.
Open

        self.assertEqual(test_region.clip_to_usable_region(
            Rectangle(0, 0, 960, 1080)),
            Rectangle(x=0, y=0, width=960, height=1080))
Severity: Major
Found in tests/test_util.py and 3 other locations - About 1 hr to fix
tests/test_util.py on lines 632..634
tests/test_util.py on lines 635..637
tests/test_util.py on lines 638..640

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

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 toggle_state has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def toggle_state(
Severity: Major
Found in quicktile/commands.py - About 1 hr to fix

    Function _update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _update(self):
            """Check input values and regenerate internal caches
    
            This is internal code shared by :meth:`set_monitors` and
            :meth:`set_panels`.
    Severity: Minor
    Found in quicktile/util.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 _gather_struts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _gather_struts(self):
            """Gather all toplevel _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL values"""
            struts = []
            for wid in [self.x_root.id] + list(self.get_property(
                    self.x_root.id, '_NET_CLIENT_LIST', Xatom.WINDOW, [])):
    Severity: Minor
    Found in quicktile/wm.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 lookup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def lookup(name: str,
               frame: FrameType,
               local_vars: Dict[str, Any]
               ) -> Tuple[Scope, Any]:
        """Find the value for a given name in the given frame
    Severity: Minor
    Found in quicktile/gtkexcepthook.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 cycle_monitors has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def cycle_monitors(winman: WindowManager,  # pylint: disable=too-many-arguments
    Severity: Major
    Found in quicktile/commands.py - About 50 mins to fix

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

              self.assertEqual(test_region.clip_to_usable_region(
                  Rectangle(0, 0, 80, 80)), Rectangle(0, 56, 80, 80 - 56))
      Severity: Minor
      Found in tests/test_util.py and 1 other location - About 50 mins to fix
      tests/test_util.py on lines 714..715

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

      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

              self.assertEqual(test_region.clip_to_usable_region(
                  Rectangle(3200, 0, 80, 80)), Rectangle(3200, 56, 80, 80 - 56))
      Severity: Minor
      Found in tests/test_util.py and 1 other location - About 50 mins to fix
      tests/test_util.py on lines 712..713

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

      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 reposition has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def reposition(self,  # pylint: disable=too-many-arguments
      Severity: Minor
      Found in quicktile/wm.py - About 45 mins to fix

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

            def __new__(cls, x: int = None, y: int = None,
        Severity: Minor
        Found in quicktile/util.py - About 45 mins to fix

          Function format_annotation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def format_annotation(annotation, *args, **kwargs):
              """Wrapper to override lookup for certain autodoc cross-references"""
              if inspect.isclass(annotation):
                  full_name = '{}.{}'.format(
                      annotation.__module__, annotation.__qualname__)
          Severity: Minor
          Found in docs/conf.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

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

                  for ref_rect in (Rectangle(0, 0, 100, 200), Rectangle(-30, -40, 0, 0),
                          Rectangle(300, 400, 0, 0), Rectangle(-200, -200, 1000, 1000)):
          Severity: Minor
          Found in tests/test_util.py and 1 other location - About 45 mins to fix
          tests/test_util.py on lines 473..474

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

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

              def update_geometry_cache(self):
                  """Update the internal cache of monitor & panel shapes by querying
                  them from the desktop, either using ``_GTK_WORKAREAS_D0`` or by
                  running and processing them into a
                  :class:`quicktile.util.UsableRegion`.
          Severity: Minor
          Found in quicktile/wm.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 set_property has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def set_property(self,  # pylint: disable=too-many-arguments
          Severity: Minor
          Found in quicktile/wm.py - About 45 mins to fix

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

            def trigger_keyboard_action(
            Severity: Minor
            Found in quicktile/commands.py - About 45 mins to fix

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

                          for test_rect in (Rectangle(0, 0, 3, 0), Rectangle(-1000, 0, 1, 2),
                                  Rectangle(1000, 1000, 100, 100), Rectangle(10, 10, 10, 1)):
              Severity: Minor
              Found in tests/test_util.py and 1 other location - About 45 mins to fix
              tests/test_util.py on lines 471..472

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

              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 3 locations. Consider refactoring.
              Open

                      test_region.set_monitors([
                          Rectangle(0, 56, 1280, 1024),
                          Rectangle(1280, 0, 1920, 1080),
                          Rectangle(3200, 56, 1280, 1024)])
              Severity: Major
              Found in tests/test_util.py and 2 other locations - About 40 mins to fix
              tests/test_util.py on lines 585..588
              tests/test_util.py on lines 760..763

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

              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

                                  (Edge.LEFT, Rectangle(x=dtop_rect.x, y=strut.left_start_y,
                                      width=strut.left, y2=strut.left_end_y
              Severity: Minor
              Found in tests/test_util.py and 1 other location - About 40 mins to fix
              tests/test_util.py on lines 142..143

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

              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