Showing 97 of 164 total issues

File player.py has 451 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import threading
import time

import cozy.ext.inject as inject
from gi.repository import Gst, GLib
Severity: Minor
Found in cozy/control/player.py - About 6 hrs to fix

    File main_view.py has 373 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import webbrowser
    
    import cozy.ext.inject as inject
    from cozy.application_settings import ApplicationSettings
    from cozy.architecture.event_sender import EventSender
    Severity: Minor
    Found in cozy/ui/main_view.py - About 4 hrs to fix

      File __init__.py has 370 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      Python dependency injection framework.
      
      Usage:
      - Create an optional configuration::
      Severity: Minor
      Found in cozy/ext/inject/__init__.py - About 4 hrs to fix

        Player has 35 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Player(EventSender):
            _library: Library = inject.attr(Library)
            _app_settings: ApplicationSettings = inject.attr(ApplicationSettings)
        
            _gst_player: GstPlayer = inject.attr(GstPlayer)
        Severity: Minor
        Found in cozy/media/player.py - About 4 hrs to fix

          File mpris.py has 344 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Forked from https://github.com/gnumdk/lollypop/blob/master/lollypop/mpris.py
          # copyright (c) 2014-2017 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
          # copyright (c) 2016 Gaurav Narula
          # copyright (c) 2016 Felipe Borges <felipeborges@gnome.org>
          # copyright (c) 2013 Arnel A. Borja <kyoushuu@yahoo.com>
          Severity: Minor
          Found in cozy/control/mpris.py - About 4 hrs to fix

            CozyUI has 33 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class CozyUI(EventSender, metaclass=Singleton):
                """
                CozyUI is the main ui class.
                """
                # Is currently an dialog open?
            Severity: Minor
            Found in cozy/ui/main_view.py - About 4 hrs to fix

              Book has 31 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Book(Observable, EventSender):
                  _chapters: List[Chapter] = None
                  _settings: Settings = inject.attr(Settings)
                  _app_settings: ApplicationSettings = inject.attr(ApplicationSettings)
              
              
              Severity: Minor
              Found in cozy/model/book.py - About 3 hrs to fix

                BookDetailViewModel has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class BookDetailViewModel(Observable, EventSender):
                    _player: Player = inject.attr(Player)
                    _fs_monitor: FilesystemMonitor = inject.attr("FilesystemMonitor")
                    _offline_cache: OfflineCache = inject.attr(OfflineCache)
                    _settings: Settings = inject.attr(Settings)
                Severity: Minor
                Found in cozy/view_model/book_detail_view_model.py - About 3 hrs to fix

                  File settings.py has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  from threading import Thread
                  import logging
                  import gi
                  
                  from cozy.control.db import remove_tracks_with_path
                  Severity: Minor
                  Found in cozy/ui/settings.py - About 2 hrs to fix

                    LibraryViewModel has 25 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class LibraryViewModel(Observable, EventSender):
                        _application_settings: ApplicationSettings = inject.attr(ApplicationSettings)
                        _fs_monitor: FilesystemMonitor = inject.attr("FilesystemMonitor")
                        _model = inject.attr(Library)
                        _importer: Importer = inject.attr(Importer)
                    Severity: Minor
                    Found in cozy/view_model/library_view_model.py - About 2 hrs to fix

                      MPRIS has 25 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class MPRIS(Server):
                          """
                          <!DOCTYPE node PUBLIC
                          "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
                          "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
                      Severity: Minor
                      Found in cozy/control/mpris.py - About 2 hrs to fix

                        Function _process_queue has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _process_queue(self):
                                log.info("Startet processing queue")
                                self.filecopy_cancel = Gio.Cancellable()
                        
                                self._fill_queue_from_db()
                        Severity: Minor
                        Found in cozy/control/offline_cache.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

                        BookDetailView has 24 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class BookDetailView(Gtk.EventBox):
                            __gtype_name__ = 'BookDetail'
                        
                            back_button: Gtk.Button = Gtk.Template.Child()
                        
                        
                        Severity: Minor
                        Found in cozy/ui/book_detail_view.py - About 2 hrs to fix

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

                          class Headerbar(HeaderBar):
                              __gtype_name__ = "Headerbar"
                          
                              seek_bar: SeekBar = Gtk.Template.Child()
                          
                          
                          Severity: Minor
                          Found in cozy/ui/headerbar.py - About 2 hrs to fix

                            Library has 22 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Library(EventSender):
                                _db = cache = inject.attr(SqliteDatabase)
                                _settings: Settings = inject.attr(Settings)
                            
                                _books: List[Book] = []
                            Severity: Minor
                            Found in cozy/model/library.py - About 2 hrs to fix

                              Function __call__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def __call__(self, func: Callable[..., Union[Awaitable[T], T]]) -> Callable[..., Union[Awaitable[T], T]]:
                                      if sys.version_info.major == 2:
                                          arg_names = inspect.getargspec(func).args
                                      else:
                                          arg_names = inspect.getfullargspec(func).args
                              Severity: Minor
                              Found in cozy/ext/inject/__init__.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 player.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import logging
                              import time
                              from threading import Thread
                              from typing import Optional
                              
                              
                              Severity: Minor
                              Found in cozy/media/player.py - About 2 hrs to fix

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

                                class ApplicationSettings(EventSender):
                                    _settings: Gio.Settings = inject.attr(Gio.Settings)
                                
                                    def __init__(self):
                                        super().__init__()
                                Severity: Minor
                                Found in cozy/application_settings.py - About 2 hrs to fix

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

                                  class Settings(EventSender):
                                      """
                                      This class contains all logic for cozys preferences.
                                      """
                                      _glib_settings: Gio.Settings = inject.attr(Gio.Settings)
                                  Severity: Minor
                                  Found in cozy/ui/settings.py - About 2 hrs to fix

                                    Function _load_pixbuf_from_file has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def _load_pixbuf_from_file(self, book):
                                            """
                                            Try to load the artwork from a book from image files.
                                            :param book: The book to load the artwork from.
                                            :return: Artwork as pixbuf object.
                                    Severity: Minor
                                    Found in cozy/control/artwork_cache.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language