DominikPott/tasker

View on GitHub

Showing 8 of 22 total issues

File ui.py has 459 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import inspect, os

from qtpy import QtCore, QtWidgets, QtGui

import tasker.control
Severity: Minor
Found in tasker/ui.py - About 7 hrs to fix

    File control.py has 457 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """API for the tasker module.
    
    the :mod:`tasker.control` module contains the api to generate projects and work with tasks.
    
    Example:
    Severity: Minor
    Found in tasker/control.py - About 7 hrs to fix

      Function filter_by_searchbar has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def filter_by_searchbar(self, unfiltered):
              filter_word = self.search_bar.text()
              if filter_word:
                  filtered = set()
                  for item in unfiltered:  # filter the item names
      Severity: Minor
      Found in tasker/ui.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

      Function make_menu_bar has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def make_menu_bar(self):
              menu_bar = self.menuBar()
      
              new_project_action = QtWidgets.QAction('New Project', self)
              new_project_action.triggered.connect(self.new_project)
      Severity: Minor
      Found in tasker/ui.py - About 1 hr to fix

        Function _update_self has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _update_self(self, session):
                task_data = session.query(TaskData).filter(TaskData.id == self.id).first()
                if not task_data.dependencies:  # No previous task so set state to can_start
                    if task_data.state == State.pending:
                        task_data.state = State.can_start
        Severity: Minor
        Found in tasker/control.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 parent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def parent(self):
                with session_scope() as session:
                    task = session.query(TaskData).filter(TaskData.id == self.id).first()
                    parent = task.parent
                    if not parent:
        Severity: Minor
        Found in tasker/control.py - About 35 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 add_task_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_task_items(self, parent):
                if not parent:
                    return
                parent.takeChildren()
                for task in parent.data(0, QtCore.Qt.UserRole).tasks:
        Severity: Minor
        Found in tasker/ui.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

        Function tasks_from_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def tasks_from_template(template):
            """Converts a template to a list of tasks.
        
            Args:
                template (dict): A configuration file to generate tasks and dependencies for the new asset from.
        Severity: Minor
        Found in tasker/control.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