Showing 150 of 257 total issues

Function _index_prep has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _index_prep(self, info):
        res = dict()
        if 'entity_attributes' in info:
            for a, v in list(info.pop('entity_attributes').items()):
                info[a] = v
Severity: Minor
Found in src/pyff/store.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 entitiesdescriptor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def entitiesdescriptor(
    entities,
    name,
    lookup_fn=None,
    cache_duration=None,
Severity: Minor
Found in src/pyff/samlmd.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 process_handler has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def process_handler(request: Request) -> Response:
    """
    The main request handler for pyFF. Implements API call hooks and content negotiation.

    :param request: the HTTP request object
Severity: Minor
Found in src/pyff/api.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

                if (
                    'sso/post' in location
                    or 'sso/redirect' in location
                    or 'saml2/sp/acs' in location
                    or 'saml2/ls' in location
    Severity: Critical
    Found in src/pyff/samlmd.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                  if (
                      'sso/post' in location
                      or 'sso/redirect' in location
                      or 'saml2/sp/acs' in location
                      or 'saml2/ls' in location
      Severity: Critical
      Found in src/pyff/utils.py - About 1 hr to fix

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

        def find_matching_files(d, extensions):
            for top, dirs, files in os.walk(d):
                for dn in dirs:
                    if dn.startswith("."):
                        dirs.remove(dn)
        Severity: Minor
        Found in src/pyff/utils.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 find_in_document has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_in_document(t, member):
            relt = root(t)
            if is_text(member):
                if '!' in member:
                    (src, xp) = member.split("!")
        Severity: Minor
        Found in src/pyff/samlmd.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 pipe has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def pipe(*args, **kwargs) -> Callable:
            """
            A decorator that registers a function as a pipeline in pyFF. Functions decorated *should* have the
            following prototype:
        
        
        Severity: Minor
        Found in src/pyff/pipes.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 _reindex has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _reindex(self):
                log.debug("indexing the store...")
                self._last_index_time = datetime.now()
                seen = set()
                refs = set([b2u(s) for s in self.objects.keys()])
        Severity: Minor
        Found in src/pyff/store.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 __call__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def __call__(self, *args, **kwargs):
                watched = kwargs.pop('watched', None)
                scheduler = kwargs.pop('scheduler', None)
                if watched is not None and scheduler is not None:
                    for r in watched.walk():
        Severity: Minor
        Found in src/pyff/store.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def __init__(
        Severity: Major
        Found in src/pyff/pipes.py - About 1 hr to fix

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

          def entitiesdescriptor(
          Severity: Major
          Found in src/pyff/samlmd.py - About 1 hr to fix

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

                def __init__(
            Severity: Major
            Found in src/pyff/constants.py - About 1 hr to fix

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

                  def _setup(self):
                      if self.url is not None:
                          if "://" not in self.url:
                              pth = os.path.abspath(self.url)
                              if os.path.isdir(pth):
              Severity: Minor
              Found in src/pyff/resource.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 release has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def release(self):
                      """Release the currently held lock.
              
                      * In case the current thread holds no lock, a ValueError is thrown."""
              
              
              Severity: Minor
              Found in src/pyff/locks.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 safe_write has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def safe_write(fn, data, mkdirs=False):
                  """Safely write data to a file with name fn
                  :param fn: a filename
                  :param data: some string data to write
                  :param mkdirs: create directories along the way (False by default)
              Severity: Minor
              Found in src/pyff/utils.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 _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 load_pipe has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def load_pipe(d: Any) -> Tuple[Callable, Any, str, Optional[Union[str, Dict, List]]]:
                  """Return a triple callable,name,args of the pipe specified by the object d.
              
                  :param d: The following alternatives for d are allowed:
              
              
              Severity: Minor
              Found in src/pyff/pipes.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
                Severity
                Category
                Status
                Source
                Language