Showing 169 of 257 total issues

Function _filter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _filter(req: Plumbing.Request, *opts):
    """

    Refines the working document by applying a filter. The filter expression is a subset of the
    select semantics and syntax:
Severity: Minor
Found in src/pyff/builtins.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 difftool has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def difftool():
    """
    diff two saml metadata sources
    """
    args = parse_options("samldiff", __doc__, 'hv', ['help', 'loglevel=', 'version'])
Severity: Minor
Found in src/pyff/tools.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 discojson has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def discojson(e, sources=None, langs=None, fallback_to_favicon=False, icon_store=None):
    if e is None:
        return dict()

    title, descr = entity_extended_display(e)
Severity: Minor
Found in src/pyff/samlmd.py - About 1 hr to fix

    Function prune has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def prune(req: Plumbing.Request, *opts):
        """
    
        Prune the active tree, removing all elements matching
    
    
    Severity: Minor
    Found in src/pyff/builtins.py - About 55 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 _store has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _store(req: Plumbing.Request, *opts):
        """
    
        Save the working document as separate files
    
    
    Severity: Minor
    Found in src/pyff/builtins.py - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self):
            while not self.halt:
                log.debug("waiting for pool {}....".format(self._id))
                with self.pool:
                    url = self.request.get()
    Severity: Minor
    Found in src/pyff/fetch.py - About 55 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 resolve_entities has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def resolve_entities(entities, lookup_fn=None):
        """
    
        :param entities: a set of entities specifiers (lookup is used to find entities from this set)
        :param lookup_fn:  a function used to lookup entities by name
    Severity: Minor
    Found in src/pyff/samlmd.py - About 55 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 lookup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def lookup(self, key):
            if key == 'entities' or key is None:
                return self._entities()
    
            bkey = six.b(key)
    Severity: Minor
    Found in src/pyff/store.py - About 55 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 with_entity_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def with_entity_attributes(entity, cb):
        def _stext(e):
            if e.text is not None:
                return e.text.strip()
    
    
    Severity: Minor
    Found in src/pyff/samlmd.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

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

    def entity_contacts(entity):
        def _contact_dict(contact):
            first_name = first_text(contact, "{%s}GivenName" % NS['md'])
            last_name = first_text(contact, "{%s}SurName" % NS['md'])
            org = first_text(entity, "{%s}OrganizationName" % NS['md']) or first_text(
    Severity: Minor
    Found in src/pyff/samlmd.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

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

        def lookup(self, member, xp=None, store=None):
            """
            Lookup elements in the working metadata repository
    
            :param member: A selector (cf below)
    Severity: Minor
    Found in src/pyff/repo.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

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

        def update(self, t, tid=None, etag=None, lazy=True):
            relt = root(t)
            assert relt is not None
            if relt.tag == "{%s}EntityDescriptor" % NS['md']:
                self._unindex(relt)
    Severity: Minor
    Found in src/pyff/store.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

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

    def img_to_data(data: bytes, content_type: str) -> Optional[str]:
        """Convert a file (specified by a path) into a data URI."""
        mime_type, options = cgi.parse_header(content_type)
        data64 = None
        if len(data) > config.icon_maxsize:
    Severity: Minor
    Found in src/pyff/utils.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

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

        def _lookup(self, member, store=None):
            if store is None:
                store = self.store
    
            if member is None:
    Severity: Minor
    Found in src/pyff/repo.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

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

        def __call__(self, watched=None, url=None, response=None, exception=None, last_fetched=None):
    Severity: Minor
    Found in src/pyff/resource.py - About 35 mins to fix

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

      def filter_or_validate(
      Severity: Minor
      Found in src/pyff/samlmd.py - About 35 mins to fix

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

            def __init__(self, request, response, pool, name, content_handler):
        Severity: Minor
        Found in src/pyff/fetch.py - About 35 mins to fix

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

          def discojson(e, sources=None, langs=None, fallback_to_favicon=False, icon_store=None):
          Severity: Minor
          Found in src/pyff/samlmd.py - About 35 mins to fix

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

                def i_handle(self, t: Resource, url=None, response=None, exception=None, last_fetched=None):
            Severity: Minor
            Found in src/pyff/resource.py - About 35 mins to fix

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

                  def i_handle(self, t, url=None, response=None, exception=None, last_fetched=None):
              Severity: Minor
              Found in src/pyff/resource.py - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language