krassowski/Anki-Night-Mode

View on GitHub

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
Severity: Major
Found in night_mode/stylers.py - About 1 day to fix

    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):
    Severity: Minor
    Found in night_mode/styles.py - About 4 hrs to fix

      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
      Severity: Minor
      Found in night_mode/internals.py - About 3 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 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
      Severity: Minor
      Found in night_mode/actions_and_settings.py - About 2 hrs to fix

        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)
        
        
        Severity: Minor
        Found in night_mode/mode.py - About 1 hr to fix

          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.
                  """
          Severity: Minor
          Found in night_mode/night_mode.py - About 55 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 create_action has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def create_action(self, name, text, callback, checkable=False, shortcut=None):
          Severity: Minor
          Found in night_mode/menu.py - About 35 mins to fix

            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):
            Severity: Minor
            Found in night_mode/color_map.py - About 35 mins to fix

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

                  def init(self, editor, mw, widget, parentWindow, addMode=False):
              Severity: Minor
              Found in night_mode/stylers.py - About 35 mins to fix

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

                    def _addButton(self, editor, icon, command, *args, **kwargs):
                Severity: Minor
                Found in night_mode/stylers.py - About 35 mins to fix

                  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):
                  Severity: Minor
                  Found in night_mode/selector.py - About 35 mins to fix

                    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
                    
                    
                    Severity: Minor
                    Found in night_mode/internals.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

                    Severity
                    Category
                    Status
                    Source
                    Language