ssokolow/quicktile

View on GitHub

Showing 197 of 198 total issues

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

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

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 653..656
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

Function background_proc has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def background_proc(argv, env: Dict[str, Union[bytes, str]], verbose=False,
Severity: Minor
Found in functional_harness/env_general.py - About 35 mins to fix

    Function toggle_desktop has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function cycle_monitors_all has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function workspace_go has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

          Function __call__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __call__(self,
          Severity: Minor
          Found in quicktile/layout.py - About 35 mins to fix

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

            def analyse(exctyp: Type[BaseException],
                        value: BaseException,
                        tracebk: TracebackType,
                        context_lines: int = 3,
                        ) -> StringIO:
            Severity: Minor
            Found in quicktile/gtkexcepthook.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

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

                def get_workspace(self,
                            window: Wnck.Window = None,
                            direction: Union[Wnck.MotionDirection, int] = None,
                            wrap_around: bool = True,
                                  ) -> Optional[Wnck.Workspace]:
            Severity: Minor
            Found in quicktile/wm.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

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

            def init(modmask: Optional[str],
                     mappings: Dict[str, str],
                     commands: CommandRegistry,
                     winman: WindowManager,
                     ) -> Optional[KeyBinder]:
            Severity: Minor
            Found in quicktile/keybinder.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

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

            def persist_maximization(win: Wnck.Window, keep_maximize: bool = True):
                """Context manager to persist maximization state after a call to
                :any:`WindowManager.reposition`.
            
                :param win: The window to operate on.
            Severity: Minor
            Found in quicktile/wm.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 Scope.NONE, None
            Severity: Major
            Found in quicktile/gtkexcepthook.py - About 30 mins to fix

              Function test_powerset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def test_powerset(self):
                      """Test that powerset() behaves as expected"""
                      src_set = (1, 2, 3)
                      expected = [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
              
              
              Severity: Minor
              Found in tests/test_util.py - About 25 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 get_relevant_windows has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_relevant_windows(self, workspace: Wnck.Workspace
                                           ) -> Iterable[Wnck.Window]:
                      """Wrapper for :meth:`Wnck.Screen.get_windows` that filters out windows
                      of type :any:`Wnck.WindowType.DESKTOP` or :any:`Wnck.WindowType.DOCK`.
              
              
              Severity: Minor
              Found in quicktile/wm.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run(self) -> bool:
                      """Initialize keybinding and D-Bus if available, then call
                      :func:`Gtk.main`.
              
                      :returns: :any:`False` if none of the supported backends
              Severity: Minor
              Found in quicktile/__main__.py - About 25 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

              TODO found
              Open

                      # TODO: Test edge pixels for off-by-one errors
              Severity: Minor
              Found in tests/test_util.py by fixme

              TODO found
              Open

                  grep -E 'XXX|TODO|FIXME' -nR *.py quicktile functional_harness
              Severity: Minor
              Found in docs/developing.rst by fixme

              TODO found
              Open

              # TODO: Check how this affects the output
              Severity: Minor
              Found in docs/conf.py by fixme

              TODO found
              Open

              # TODO: Narrow down the type signature
              Severity: Minor
              Found in quicktile/util.py by fixme
              Severity
              Category
              Status
              Source
              Language