6uhrmittag/taskbutler

View on GitHub

Showing 10 of 24 total issues

Function main has a Cognitive Complexity of 178 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    # create config
    if not os.path.exists(getConfigPaths().config()):
        os.mkdir(getConfigPaths().app(), mode=0o750)
        os.mkdir(getConfigPaths().config(), mode=0o750)
Severity: Minor
Found in taskbutler/taskbutler.py - About 3 days 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 taskbutler.py has 503 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import codecs
import logging
Severity: Major
Found in taskbutler/taskbutler.py - About 1 day to fix

    Function gettaskwithlabelid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def gettaskwithlabelid(labelid, api):
        """
        Returns a list of Task IDs found with given label-ID
    
        :param labelid: (str) label ID of label to search for
    Severity: Minor
    Found in taskbutler/taskbutler.py - About 1 hr 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

    Avoid deeply nested control flow statements.
    Open

                        for label in task['labels']:
                            if label == label_grocery_id:
                                logger.debug("Found grocery list: {}".format(task['content']))
    
                                grocery_value_total_old = float(0)
    Severity: Major
    Found in taskbutler/taskbutler.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if label == label_progress_id:
                              logger.debug("Found task to track: {}".format(task['content']))
      
                              counter_progress = counter_progress + 1
                              subtasks_total = 0
      Severity: Major
      Found in taskbutler/taskbutler.py - About 45 mins to fix

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

        def createpaperdocument(title, dbx, todoistfolderid, todoistpaperurl, sharing) -> str:
        Severity: Minor
        Found in taskbutler/taskbutler.py - About 35 mins to fix

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

          def createdropboxfile(title, dbx, templatefile, dropbox_prepart_files, folder) -> str:
          Severity: Minor
          Found in taskbutler/taskbutler.py - About 35 mins to fix

            Function getprogresssymbols has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def getprogresssymbols(progress_done, secrets):
                """
                Returns unicode bar based on given percentage.
            
                :param secrets:
            Severity: Minor
            Found in taskbutler/taskbutler.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 gettodoistfolderid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def gettodoistfolderid(foldername: str, dbx):
                """
            
                Dropbox - Get Folder ID of folder "todoist" from user account
                Note : only finds folder once a paper is created in. create test paper first.
            Severity: Minor
            Found in taskbutler/taskbutler.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

            Avoid too many return statements within this function.
            Open

                    return 1
            Severity: Major
            Found in taskbutler/taskbutler.py - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language