ssokolow/quicktile

View on GitHub

Showing 44 of 198 total issues

File util.py has 736 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Helper functions and classes"""

__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__license__ = "GNU GPL 2.0 or later"

Severity: Major
Found in quicktile/util.py - About 1 day to fix

    File test_util.py has 705 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    """Tests for ``quicktile.util`` module"""
    
    __author__ = "Stephan Sokolow (deitarion/SSokolow)"
    __license__ = "GNU GPL 2.0 or later"
    Severity: Major
    Found in tests/test_util.py - About 1 day to fix

      File commands.py has 422 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Available window-management commands
      
      .. todo:: Replace varargs with a dict so ``CommandCBWrapper`` can be strict.
      """
      
      
      Severity: Minor
      Found in quicktile/commands.py - About 6 hrs to fix

        File wm.py has 361 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Wrapper around libwnck for interacting with the window manager"""
        
        __author__ = "Stephan Sokolow (deitarion/SSokolow)"
        __license__ = "GNU GPL 2.0 or later"
        
        
        Severity: Minor
        Found in quicktile/wm.py - About 4 hrs to fix

          Function gather_vars has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

          def gather_vars(frame_rec: inspect.FrameInfo,
                          local_vars: Dict[str, Any]) -> Dict[str, Any]:
              """Extract all the local variables from the given traceback frame using
              :func:`lookup`.
          
          
          Severity: Minor
          Found in quicktile/gtkexcepthook.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 load_config has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          def load_config(path) -> ConfigParser:
              """Load the config file from the given path, applying fixes as needed.
              If it does not exist, create it from the configuration defaults.
          
              :param path: The path to load or initialize.
          Severity: Minor
          Found in quicktile/config.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 main has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def main() -> None:
              """setuptools-compatible entry point
          
              :raises XInitError: Failed to connect to the X server.
          
          
          Severity: Minor
          Found in quicktile/__main__.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

          File gtkexcepthook.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #!/usr/bin/env python3
          # pylint: disable=line-too-long
          """Graphical exception handler for PyGTK applications
          
          Usage
          Severity: Minor
          Found in quicktile/gtkexcepthook.py - About 2 hrs to fix

            TestRectangle has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class TestRectangle(unittest.TestCase):  # pylint: disable=R0904
                """Tests for my custom `Rectangle` class"""
            
                def setUp(self):
                    """Implicitly test positional and keyword construction during setup"""
            Severity: Minor
            Found in tests/test_util.py - About 2 hrs to fix

              Rectangle has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Rectangle(_Rectangle):
                  """A representation of a rectangle with some useful methods
              
                  Fundamentally, this is a named tuple of the form ``(x, y, width, height)``
                  with some extra methods and properties to make it more useful.
              Severity: Minor
              Found in quicktile/util.py - About 2 hrs to fix

                Function _trim_strut has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _trim_strut(self, strut: Tuple[Edge, Rectangle]) -> Rectangle:
                        """Trim a strut rectangle to just the monitor it applies to
                
                        This is internal code used by :meth:`_update` but split out to manage
                        complexity and improve testability.
                Severity: Minor
                Found in quicktile/util.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 fmt_table has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                def fmt_table(rows: Union[Dict, Iterable[List]],
                              headers: Sequence[str],
                              group_by: int = None,
                              ) -> str:
                    """Format a collection as a textual table.
                Severity: Minor
                Found in quicktile/util.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 add has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def add(self, name: str, *p_args: Any, **p_kwargs: Any
                            ) -> Callable[[CommandCB], CommandCB]:
                        """Decorator to wrap a function in boilerplate and add it to the
                            command registry under the given name.
                
                
                Severity: Minor
                Found in quicktile/commands.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 __call__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __call__(self,
                            exctyp: Type[BaseException],
                            value: BaseException,
                            tback: TracebackType):
                        """Custom :any:`sys.excepthook` callback which displays a GTK dialog"""
                Severity: Minor
                Found in quicktile/gtkexcepthook.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 __new__ has 13 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __new__(cls, left=0, right=0, top=0, bottom=0,  # pylint: disable=R0913
                Severity: Major
                Found in quicktile/util.py - About 1 hr to fix

                  Function __new__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __new__(cls, x: int = None, y: int = None,
                                  width: int = None, height: int = None,
                                  x2: int = None, y2: int = None):
                  
                          # -- Check for a valid combination of arguments --
                  Severity: Minor
                  Found in quicktile/util.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 reposition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def reposition(self,  # pylint: disable=too-many-arguments
                              win: Wnck.Window,
                              geom: Optional[Rectangle] = None,
                              monitor: Rectangle = Rectangle(0, 0, 0, 0),
                              keep_maximize: bool = False,
                  Severity: Minor
                  Found in quicktile/wm.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 test_clip_to_usable_region has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def test_clip_to_usable_region(self):
                          """UsableRegion: clip_to_usable_region"""
                          test_region = UsableRegion()
                  
                          # Quick integration test for internal call to find_monitor_for
                  Severity: Minor
                  Found in tests/test_util.py - About 1 hr to fix

                    Function x_server has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def x_server(argv: List[str], screens: Dict[int, str]
                                 ) -> Generator[Dict[str, str], None, None]:
                        """Context manager to launch and then clean up an X server.
                    
                        :param argv: The command to launch the test X server and
                    Severity: Minor
                    Found in functional_harness/x_server.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 test_creates_on_first_run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def test_creates_on_first_run(self):
                            """Config file is created if it doesn't exist"""
                            self.assertFalse(os.path.exists(self.testpath))
                            parsed = config.load_config(self.testpath)
                            self.assertTrue(os.path.exists(self.testpath))
                    Severity: Minor
                    Found in tests/test_quicktile.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

                    Severity
                    Category
                    Status
                    Source
                    Language