Showing 222 of 468 total issues

File builtins.py has 1018 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Package that contains the basic set of pipes - functions that can be used to put together a processing pipeling
for pyFF.
"""

from __future__ import absolute_import, print_function
Severity: Major
Found in src/pyff/builtins.py - About 2 days to fix

    Function main has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        """
        The main entrypoint for the pyffd command.
        """
        try:
    Severity: Minor
    Found in src/pyff/mdx.py - About 2 days 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 mdx.py has 749 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    An implementation of draft-lajoie-md-query
    
    .. code-block:: bash
    
    
    Severity: Major
    Found in src/pyff/mdx.py - About 1 day to fix

      Function request has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
      Open

          def request(self, **kwargs):
              """The main request processor. This code implements all rendering of metadata.
              """
              stats['MD Requests'] += 1
      
      
      Severity: Minor
      Found in src/pyff/mdx.py - About 1 day 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 samlmd.py has 703 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from __future__ import absolute_import, unicode_literals
      from datetime import datetime
      from .utils import parse_xml, check_signature, root, validate_document, xml_error, \
          schema, iso2datetime, duration2timedelta, filter_lang, url2host, trunc_str, subdomains, \
          has_tag, hash_id, load_callable, rreplace, dumptree, first_text, url_get, img_to_data
      Severity: Major
      Found in src/pyff/samlmd.py - About 1 day to fix

        Function search has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
        Open

            def search(self, query=None, path=None, page=None, page_limit=10, entity_filter=None, related=None):
                """
        :param query: A string to search for.
        :param path: The repository collection (@Name) to search in - None for search in all collections
        :param page:  When using paged search, the page index
        Severity: Minor
        Found in src/pyff/mdrepo.py - About 1 day 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

        Cyclomatic complexity is too high in function main. (46)
        Open

        def main():
            """
            The main entrypoint for the pyffd command.
            """
            try:
        Severity: Minor
        Found in src/pyff/mdx.py by radon

        Cyclomatic Complexity

        Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

        Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

        Construct Effect on CC Reasoning
        if +1 An if statement is a single decision.
        elif +1 The elif statement adds another decision.
        else +0 The else statement does not cause a new decision. The decision is at the if.
        for +1 There is a decision at the start of the loop.
        while +1 There is a decision at the while statement.
        except +1 Each except branch adds a new conditional path of execution.
        finally +0 The finally block is unconditionally executed.
        with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
        assert +1 The assert statement internally roughly equals a conditional statement.
        Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
        Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

        Source: http://radon.readthedocs.org/en/latest/intro.html

        Function guess_entity_software has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

        def guess_entity_software(e):
            for elt in chain(e.findall(".//{%s}SingleSignOnService" % NS['md']),
                             e.findall(".//{%s}AssertionConsumerService" % NS['md'])):
                location = elt.get('Location')
                if location:
        Severity: Minor
        Found in src/pyff/samlmd.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 guess_entity_software has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

        def guess_entity_software(e):
            for elt in chain(e.findall(".//{%s}SingleSignOnService" % NS['md']),
                             e.findall(".//{%s}AssertionConsumerService" % NS['md'])):
                location = elt.get('Location')
                if location:
        Severity: Minor
        Found in src/pyff/utils.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

        File utils.py has 455 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # coding=utf-8
        from __future__ import print_function, unicode_literals, absolute_import
        
        """
        
        
        Severity: Minor
        Found in src/pyff/utils.py - About 6 hrs to fix

          Function main has 173 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def main():
              """
              The main entrypoint for the pyffd command.
              """
              try:
          Severity: Major
          Found in src/pyff/mdx.py - About 6 hrs to fix

            Function hex_sha1 has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
            Open

            var hex_sha1 = function () {
            var fromCharCode = String.fromCharCode;
            /*
             * Calculate the SHA1 of a raw string
             */
            Severity: Minor
            Found in src/pyff/site/static/js/sha1.js - 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

            Cyclomatic complexity is too high in function guess_entity_software. (35)
            Open

            def guess_entity_software(e):
                for elt in chain(e.findall(".//{%s}SingleSignOnService" % NS['md']),
                                 e.findall(".//{%s}AssertionConsumerService" % NS['md'])):
                    location = elt.get('Location')
                    if location:
            Severity: Minor
            Found in src/pyff/samlmd.py by radon

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Cyclomatic complexity is too high in function guess_entity_software. (35)
            Open

            def guess_entity_software(e):
                for elt in chain(e.findall(".//{%s}SingleSignOnService" % NS['md']),
                                 e.findall(".//{%s}AssertionConsumerService" % NS['md'])):
                    location = elt.get('Location')
                    if location:
            Severity: Minor
            Found in src/pyff/utils.py by radon

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Cyclomatic complexity is too high in method request. (34)
            Open

                def request(self, **kwargs):
                    """The main request processor. This code implements all rendering of metadata.
                    """
                    stats['MD Requests'] += 1
            
            
            Severity: Minor
            Found in src/pyff/mdx.py by radon

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Function request has 156 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def request(self, **kwargs):
                    """The main request processor. This code implements all rendering of metadata.
                    """
                    stats['MD Requests'] += 1
            
            
            Severity: Major
            Found in src/pyff/mdx.py - About 6 hrs to fix

              Function btsListFilter has 127 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $.fn.btsListFilter = function(inputEl, opts) {
              
                      'use strict';
                      
                      var self = this,
              Severity: Major
              Found in src/pyff/site/static/js/bootstrap-list-filter.src.js - About 5 hrs to fix

                Function certreport has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                @pipe
                def certreport(req, *opts):
                    """
                Generate a report of the certificates (optionally limited by expiration time or key size) found in the selection.
                
                
                Severity: Minor
                Found in src/pyff/builtins.py - About 4 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 hex_sha1 has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var hex_sha1 = function () {
                var fromCharCode = String.fromCharCode;
                /*
                 * Calculate the SHA1 of a raw string
                 */
                Severity: Major
                Found in src/pyff/site/static/js/sha1.js - About 4 hrs to fix

                  Cyclomatic complexity is too high in function discojson. (22)
                  Open

                  def discojson(e, langs=None):
                      if e is None:
                          return dict()
                  
                      title, descr = entity_extended_display(e)
                  Severity: Minor
                  Found in src/pyff/samlmd.py by radon

                  Cyclomatic Complexity

                  Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                  Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                  Construct Effect on CC Reasoning
                  if +1 An if statement is a single decision.
                  elif +1 The elif statement adds another decision.
                  else +0 The else statement does not cause a new decision. The decision is at the if.
                  for +1 There is a decision at the start of the loop.
                  while +1 There is a decision at the while statement.
                  except +1 Each except branch adds a new conditional path of execution.
                  finally +0 The finally block is unconditionally executed.
                  with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                  assert +1 The assert statement internally roughly equals a conditional statement.
                  Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                  Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                  Source: http://radon.readthedocs.org/en/latest/intro.html

                  Severity
                  Category
                  Status
                  Source
                  Language