peterhudec/authomatic

View on GitHub
authomatic/core.py

Summary

Maintainability
F
4 days
Test Coverage

File core.py has 1191 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

import collections
import copy
import datetime
Severity: Major
Found in authomatic/core.py - About 3 days to fix

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

        def backend(self, adapter):
            """
            Converts a *request handler* to a JSON backend which you can use with
            :ref:`authomatic.js <js>`.
    
    
    Severity: Minor
    Found in authomatic/core.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 __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in authomatic/core.py - About 1 hr to fix

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

          def __repr__(self):
      
              # get class name
              name = self.__class__.__name__
      
      
      Severity: Minor
      Found in authomatic/core.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 login has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def login(self, adapter, provider_name, callback=None,
                    session=None, session_saver=None, **kwargs):
              """
              If :data:`provider_name` specified, launches the login procedure for
              corresponding :doc:`provider </reference/providers>` and returns
      Severity: Minor
      Found in authomatic/core.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 request_elements has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def request_elements(
      Severity: Major
      Found in authomatic/core.py - About 1 hr to fix

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

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

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

              def login(self, adapter, provider_name, callback=None,
          Severity: Minor
          Found in authomatic/core.py - About 45 mins to fix

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

                def popup_html(self, callback_name=None, indent=None,
            Severity: Minor
            Found in authomatic/core.py - About 35 mins to fix

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

                  def __init__(self, adapter, secret, name='authomatic', max_age=600,
              Severity: Minor
              Found in authomatic/core.py - About 35 mins to fix

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

                    def __new__(cls, url, method, params, headers, body):
                Severity: Minor
                Found in authomatic/core.py - About 35 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status