krateng/maloja

View on GitHub
maloja/apis/native_v1.py

Summary

Maintainability
D
3 days
Test Coverage

File native_v1.py has 738 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import math
import traceback

from bottle import response, static_file, FormsDict
Severity: Major
Found in maloja/apis/native_v1.py - About 1 day to fix

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

    def search(**keys):
        """Internal Use Only"""
        query = keys.get("query")
        max_ = keys.get("max")
        if max_ is not None: max_ = int(max_)
    Severity: Minor
    Found in maloja/apis/native_v1.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 add_pagination has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_pagination(endpoint,filterkeys=False,limitkeys=False,delimitkeys=False):
    
        def decorator(func):
            def wrapper(*args,k_filter, k_limit, k_delimit, k_amount):
    
    
    Severity: Minor
    Found in maloja/apis/native_v1.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 post_scrobble has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def post_scrobble(
    Severity: Major
    Found in maloja/apis/native_v1.py - About 1 hr to fix

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

      def catch_exceptions(func):
          def protector(*args,**kwargs):
              try:
                  return func(*args,**kwargs)
              except Exception as e:
      Severity: Minor
      Found in maloja/apis/native_v1.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 add_common_args_to_docstring has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def add_common_args_to_docstring(filterkeys=False,limitkeys=False,delimitkeys=False,amountkeys=False):
          def decorator(func):
              timeformats = "Possible formats include '2022', '2022/08', '2022/08/01', '2022/W42', 'today', 'thismonth', 'monday', 'august'"
      
              if filterkeys:
      Severity: Minor
      Found in maloja/apis/native_v1.py - About 45 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_picture has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def add_picture(k_filter, k_limit, k_delimit, k_amount, k_special):
      Severity: Minor
      Found in maloja/apis/native_v1.py - About 35 mins to fix

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

                def wrapper(*args,k_filter, k_limit, k_delimit, k_amount):
        Severity: Minor
        Found in maloja/apis/native_v1.py - About 35 mins to fix

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

          def convert_kwargs(func):
          
              #params = tuple(p for p in signature(func).parameters)
          
              def wrapper(*args,albumartist:Multi[str]=[],trackartist:Multi[str]=[],**kwargs):
          Severity: Minor
          Found in maloja/apis/native_v1.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 post_scrobble has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def post_scrobble(
                  artist:Multi=None,
                  artists:list=[],
                  title:str="",
                  album:str=None,
          Severity: Minor
          Found in maloja/apis/native_v1.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

          There are no issues that match your filters.

          Category
          Status