lepture/authlib

View on GitHub
authlib/jose/rfc7516/jwe.py

Summary

Maintainability
D
2 days
Test Coverage

Function serialize_json has a Cognitive Complexity of 53 (exceeds 10 allowed). Consider refactoring.
Open

    def serialize_json(self, header_obj, payload, keys, sender_key=None):
        """Generate a JWE JSON Serialization (in fully general syntax).

        The JWE JSON Serialization represents encrypted content as a JSON
        object.  This representation is neither optimized for compactness nor
Severity: Minor
Found in authlib/jose/rfc7516/jwe.py - About 7 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 deserialize_json has a Cognitive Complexity of 50 (exceeds 10 allowed). Consider refactoring.
Open

    def deserialize_json(self, obj, key, decode=None, sender_key=None):
        """Extract JWE JSON Serialization.

        :param obj: JWE JSON Serialization as dict or str
        :param key: Private key used to decrypt payload
Severity: Minor
Found in authlib/jose/rfc7516/jwe.py - About 6 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

File jwe.py has 533 lines of code (exceeds 460 allowed). Consider refactoring.
Open

from collections import OrderedDict
from copy import deepcopy

from authlib.common.encoding import (
    to_bytes, urlsafe_b64encode, json_b64encode, to_unicode
Severity: Major
Found in authlib/jose/rfc7516/jwe.py - About 3 hrs to fix

    Function deserialize_json has 37 lines of code (exceeds 35 allowed). Consider refactoring.
    Open

        def deserialize_json(self, obj, key, decode=None, sender_key=None):
            """Extract JWE JSON Serialization.
    
            :param obj: JWE JSON Serialization as dict or str
            :param key: Private key used to decrypt payload
    Severity: Minor
    Found in authlib/jose/rfc7516/jwe.py - About 1 hr to fix

      Function deserialize_compact has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
      Open

          def deserialize_compact(self, s, key, decode=None, sender_key=None):
              """Extract JWE Compact Serialization.
      
              :param s: JWE Compact Serialization as bytes
              :param key: Private key used to decrypt payload
      Severity: Minor
      Found in authlib/jose/rfc7516/jwe.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 serialize_compact has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
      Open

          def serialize_compact(self, protected, payload, key, sender_key=None):
              """Generate a JWE Compact Serialization.
      
              The JWE Compact Serialization represents encrypted content as a compact,
              URL-safe string. This string is::
      Severity: Minor
      Found in authlib/jose/rfc7516/jwe.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

      There are no issues that match your filters.

      Category
      Status