Showing 12 of 14 total issues
File stylers.py
has 632 lines of code (exceeds 250 allowed). Consider refactoring. Open
from PyQt5.QtCore import Qt
from PyQt5 import QtWidgets
import aqt
from anki.stats import CollectionStats
File styles.py
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
from .config import ConfigValueGetter
from .internals import css, snake_case, SingletonMetaclass, RequiringMixin
class Style(RequiringMixin, metaclass=SingletonMetaclass):
Function __init__
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def __init__(cls, name, bases, attributes):
super().__init__(name, bases, attributes)
# singleton
cls.instance = None
- 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 actions_and_settings.py
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import datetime
from PyQt5.QtCore import QTimer
from PyQt5.QtGui import QColor
from PyQt5.QtWidgets import QColorDialog
Function init_ui
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_ui(self, title):
self.setWindowTitle(title)
btn_close = create_button('Close', self.close)
Function refresh
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def refresh(self, reload=False):
"""
Refresh display by re-enabling night or normal mode,
regenerate customizable css strings.
"""
- 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
Function create_action
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_action(self, name, text, callback, checkable=False, shortcut=None):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, parent, color=None, on_color_change=None, name='Color', verify_colors=False):
Function init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def init(self, editor, mw, widget, parentWindow, addMode=False):
Function _addButton
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _addButton(self, editor, icon, command, *args, **kwargs):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, parent, disabled_stylers: set, all_stylers, title=_('Choose what to style'), on_update=None):
Function move_args_to_kwargs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def move_args_to_kwargs(original_function, args, kwargs):
args = list(args)
import inspect
- 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"