rycus86/ghost-client

View on GitHub

Showing 6 of 8 total issues

File api.py has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import mimetypes

import six
import requests
Severity: Minor
Found in ghost_client/api.py - About 2 hrs to fix

    Function execute_get has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute_get(self, resource, **kwargs):
            """
            Execute an HTTP GET request against the API endpoints.
            This method is meant for internal use.
    
    
    Severity: Minor
    Found in ghost_client/api.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

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Minor
    Found in ghost_client/api.py - About 45 mins to fix

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

          def __init__(self, data, type_name, controller, list_kwargs, model_type=Model):
      Severity: Minor
      Found in ghost_client/models.py - About 35 mins to fix

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

        def refresh_session_if_necessary(f):
            """
            Decorator to use on methods that are allowed
            to retry the request after reauthenticating the client.
        
        
        Severity: Minor
        Found in ghost_client/helpers.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 upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def upload(self, file_obj=None, file_path=None, name=None, data=None):
                """
                Upload an image and return its path on the server.
                Either `file_obj` or `file_path` or `name` and `data` has to be specified.
        
        
        Severity: Minor
        Found in ghost_client/api.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