Showing 257 of 257 total issues

Avoid too many return statements within this function.
Open

                return []
Severity: Major
Found in src/pyff/store.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return 'PySAML'
    Severity: Major
    Found in src/pyff/samlmd.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return 'OpenAthens'
      Severity: Major
      Found in src/pyff/samlmd.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return 'OpenSSO'
        Severity: Major
        Found in src/pyff/utils.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return 'Shibboleth'
          Severity: Major
          Found in src/pyff/utils.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return self._lookup("{%s}%s" % (m.group(1), str(m.group(2)).rstrip("/")))
            Severity: Major
            Found in src/pyff/store.py - About 30 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  @property  # type: ignore
                  @contextmanager
                  def readlock(self):
                      """Yields a read lock"""
                      self.acquireRead()
              Severity: Minor
              Found in src/pyff/locks.py and 1 other location - About 30 mins to fix
              src/pyff/locks.py on lines 119..127

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  @property  # type: ignore
                  @contextmanager
                  def writelock(self):
                      """Yields a write lock"""
                      self.acquireWrite()
              Severity: Minor
              Found in src/pyff/locks.py and 1 other location - About 30 mins to fix
              src/pyff/locks.py on lines 109..117

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse(self, resource: Resource, content: str) -> ParserInfo:
                      info = ParserInfo(description='XRD links', expiration_time='never expires')
                      t = parse_xml(unicode_stream(content))
              
                      relt = root(t)
              Severity: Minor
              Found in src/pyff/parse.py - About 25 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 b2u has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def b2u(data: Union[str, bytes, Tuple, List, Set]) -> Union[str, bytes, Tuple, List, Set]:
                  if is_text(data):
                      return data
                  elif isinstance(data, six.binary_type):
                      return data.decode("utf-8")
              Severity: Minor
              Found in src/pyff/utils.py - About 25 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 json_serializer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def json_serializer(o):
                  if isinstance(o, datetime):
                      return o.__str__()
                  if isinstance(o, CaseInsensitiveDict):
                      return dict(o.items())
              Severity: Minor
              Found in src/pyff/utils.py - About 25 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 search_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def search_handler(request: Request) -> Response:
                  """
                  Implements the /api/search endpoint
              
                  :param request: the HTTP request with the 'query' request parameter
              Severity: Minor
              Found in src/pyff/api.py - About 25 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 sub_domains has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def sub_domains(e):
                  lst = []
                  domains = entity_domains(e)
                  for d in domains:
                      for sub in subdomains(d):
              Severity: Minor
              Found in src/pyff/samlmd.py - About 25 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 select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def select(self, member, xp=None):
                      """
                      Select a set of metadata elements and return an EntityDescriptor with the result of the select.
              
                      :param member: A selector (cf below)
              Severity: Minor
              Found in src/pyff/store.py - About 25 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 load_requirements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def load_requirements(path: PurePath) -> List[str]:
                  """ Load dependencies from a requirements.txt style file, ignoring comments etc. """
                  res = []
                  with open(path) as fd:
                      for line in fd.readlines():
              Severity: Minor
              Found in setup.py - About 25 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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def main():
                  """
                  The (new) main entrypoint for the pyffd command.
                  """
                  args = parse_options("pyffd", __doc__)
              Severity: Minor
              Found in src/pyff/mdq.py - About 25 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_attribute_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def entity_attribute_dict(entity):
                  d = {}
              
                  def _u(an, values):
                      d[an] = values
              Severity: Minor
              Found in src/pyff/samlmd.py - About 25 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 set_nodecountry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def set_nodecountry(e, country_code):
                  """Set eidas:NodeCountry on an EntityDescriptor
              
                  :param e: The EntityDescriptor element
                  :param country_code: An ISO country code
              Severity: Minor
              Found in src/pyff/samlmd.py - About 25 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 _nodecountry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def _nodecountry(req: Plumbing.Request, *opts):
                  """
                  Sets eidas:NodeCountry
              
                  :param req: The request
              Severity: Minor
              Found in src/pyff/builtins.py - About 25 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 sort_entities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def sort_entities(t, sxp=None):
                  """
                  Sorts the working entities 't' by the value returned by the xpath 'sxp'
                  By default, entities are sorted by 'entityID' when this method is called without 'sxp', and otherwise as
                  second criteria.
              Severity: Minor
              Found in src/pyff/samlmd.py - About 25 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

              Severity
              Category
              Status
              Source
              Language