fuzeman/trakt.py

View on GitHub
trakt/core/http.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function send has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def send(self, request):
        # Retrieve http configuration
        retry = self.client.configuration.get('http.retry', DEFAULT_HTTP_RETRY)
        max_retries = self.client.configuration.get('http.max_retries', DEFAULT_HTTP_MAX_RETRIES)
        retry_sleep = self.client.configuration.get('http.retry_sleep', DEFAULT_HTTP_RETRY_SLEEP)
Severity: Minor
Found in trakt/core/http.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 request has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def request(self, method, path=None, params=None, data=None, query=None, authenticated=False,
Severity: Major
Found in trakt/core/http.py - About 1 hr to fix

    Function _validate_oauth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _validate_oauth(self):
            config = self.client.configuration
    
            # Ensure token expiry is available
            if config['oauth.created_at'] is None or config['oauth.expires_in'] is None:
    Severity: Minor
    Found in trakt/core/http.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

    Avoid too many return statements within this function.
    Open

                return False
    Severity: Major
    Found in trakt/core/http.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return False
      Severity: Major
      Found in trakt/core/http.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return True
        Severity: Major
        Found in trakt/core/http.py - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status