peterhudec/authomatic

View on GitHub
authomatic/providers/__init__.py

Summary

Maintainability
F
3 days
Test Coverage

File __init__.py has 730 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
Abstract Classes for Providers
------------------------------

Severity: Major
Found in authomatic/providers/__init__.py - About 1 day to fix

    Function login_decorator has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def login_decorator(func):
        """
        Decorate the :meth:`.BaseProvider.login` implementations with this
        decorator.
    
    
    Severity: Minor
    Found in authomatic/providers/__init__.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

    Function _update_or_create_user has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def _update_or_create_user(self, data, credentials=None, content=None):
            """
            Updates or creates :attr:`.user`.
    
            :returns:
    Severity: Minor
    Found in authomatic/providers/__init__.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

    BaseProvider has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BaseProvider(object):
        """
        Abstract base class for all providers.
        """
    
    
    Severity: Minor
    Found in authomatic/providers/__init__.py - About 2 hrs to fix

      Function _fetch has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _fetch(self, url, method='GET', params=None, headers=None,
                     body='', max_redirects=5, content_parser=None,
                     certificate_file=None, ssl_verify=True):
              """
              Fetches a URL.
      Severity: Minor
      Found in authomatic/providers/__init__.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 _fetch has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _fetch(self, url, method='GET', params=None, headers=None,
      Severity: Major
      Found in authomatic/providers/__init__.py - About 1 hr to fix

        Function access has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def access(self, url, params=None, method='GET', headers=None,
        Severity: Major
        Found in authomatic/providers/__init__.py - About 1 hr to fix

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

              def __init__(self, settings, adapter, provider_name, session=None,
          Severity: Major
          Found in authomatic/providers/__init__.py - About 1 hr to fix

            Function create_request_elements has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def create_request_elements(self, request_type, credentials,
            Severity: Major
            Found in authomatic/providers/__init__.py - About 50 mins to fix

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

                  def _log_param(cls, param, value='', last=None,
              Severity: Minor
              Found in authomatic/providers/__init__.py - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status