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
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
File __init__.py
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Python dependency injection framework.
Usage:
- Create an optional configuration::
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)
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>
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?
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)
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)
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
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)
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">
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()
- Read upRead up
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()
Headerbar
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Headerbar(HeaderBar):
__gtype_name__ = "Headerbar"
seek_bar: SeekBar = Gtk.Template.Child()
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] = []
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
- Read upRead up
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
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__()
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)
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.
- Read upRead up
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"