Showing 169 of 257 total issues

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

def annotate_entity(e, category, title, message, source=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, url=None, response=None, exception=None, last_fetched=None):
    Severity: Minor
    Found in src/pyff/resource.py - About 35 mins to fix

      Function short_spec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def short_spec(self):
              if self.short:
                  if (hasattr(self, 'typeconv') and self.typeconv == as_bool) or isinstance(self, InvertedSetting):
                      return self.short
                  else:
      Severity: Minor
      Found in src/pyff/constants.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 url_get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def url_get(url: str, verify_tls: Optional[bool] = False) -> Response:
          """
          Download an URL using a cache and return the response object
          :param url:
          :return:
      Severity: Minor
      Found in src/pyff/utils.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 entity_extended_display has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def entity_extended_display(entity, langs=None):
          """Utility-method for computing a displayable string for a given entity.
      
          :param entity: An EntityDescriptor element
          :param langs: The list of languages to search in priority order
      Severity: Minor
      Found in src/pyff/samlmd.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 _any has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _any(lst, d):
          for x in lst:
              if x in d:
                  if type(d) == dict:
                      return d[x]
      Severity: Minor
      Found in src/pyff/builtins.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 filter_or_validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def filter_or_validate(
          t: ElementTree,
          filter_invalid: bool = False,
          base_url: str = "",
          source=None,
      Severity: Minor
      Found in src/pyff/samlmd.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 _all_domains_and_subdomains has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _all_domains_and_subdomains(entity):
          dlist = []
          try:
              for dn in _domains(entity):
                  for sub in subdomains(dn):
      Severity: Minor
      Found in src/pyff/samlmd.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 filter_lang has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def filter_lang(elts: Any, langs: Optional[Sequence[str]] = None) -> List[Element]:
          if langs is None or type(langs) is not list:
              langs = config.langs
      
          # log.debug("langs: {}".format(langs))
      Severity: Minor
      Found in src/pyff/utils.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 metadata_expiration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def metadata_expiration(t: ElementTree) -> Optional[timedelta]:
          relt = root(t)
          if relt.tag in ('{%s}EntityDescriptor' % NS['md'], '{%s}EntitiesDescriptor' % NS['md']):
              cache_duration = config.default_cache_duration
              valid_until = relt.get('validUntil', None)
      Severity: Minor
      Found in src/pyff/samlmd.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 _select has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

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

      Severity
      Category
      Status
      Source
      Language