kalefranz/auxlib

View on GitHub

Showing 242 of 242 total issues

Function done has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function done( status, nativeStatusText, responses, headers ) {
            var isSuccess, success, error, response, modified,
                statusText = nativeStatusText;

            // Called once
Severity: Major
Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

    Function setMatcher has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
        if ( postFilter && !postFilter[ expando ] ) {
            postFilter = setMatcher( postFilter );
        }
        if ( postFinder && !postFinder[ expando ] ) {
    Severity: Major
    Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

      Cyclomatic complexity is too high in function boolify. (10)
      Open

      def boolify(value, nullable=False, return_string=False):
          """Convert a number, string, or sequence type into a pure boolean.
      
          Args:
              value (number, string, sequence): pretty much anything
      Severity: Minor
      Found in auxlib/type_coercion.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 box. (10)
      Open

          def box(self, instance, instance_type, val):
              if val is None:
                  return None
              if isinstance(val, self._type):
                  return val
      Severity: Minor
      Found in auxlib/entity.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 write_version_into_init. (10)
      Open

      def write_version_into_init(target_dir, version):
          target_init_file = join(target_dir, "__init__.py")
          assert isfile(target_init_file), "File not found: {0}".format(target_init_file)
          with open(target_init_file, 'r') as f:
              init_lines = f.readlines()
      Severity: Minor
      Found in auxlib/packaging.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 make_immutable. (10)
      Open

      def make_immutable(value):
          # this function is recursive, and if nested data structures fold back on themselves,
          #   there will likely be recursion errors
          if isinstance(value, Mapping):
              if isinstance(value, frozenodict):
      Severity: Minor
      Found in auxlib/collection.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 superMatcher has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              superMatcher = function( seed, context, xml, results, outermost ) {
                  var elem, j, matcher,
                      matchedCount = 0,
                      i = "0",
                      unmatched = seed && [],
      Severity: Major
      Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

        Function send has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        send: function( headers, complete ) {
                            var i,
                                xhr = options.xhr(),
                                id = ++xhrId;
        
        
        Severity: Major
        Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

          Function domManip has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              domManip: function( args, callback ) {
          
                  // Flatten any nested arrays
                  args = concat.apply( [], args );
          
          
          Severity: Major
          Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

            Function init has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                init = jQuery.fn.init = function( selector, context ) {
                    var match, elem;
            
                    // HANDLE: $(""), $(null), $(undefined), $(false)
                    if ( !selector ) {
            Severity: Major
            Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

              Function CHILD has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      "CHILD": function( type, what, argument, first, last ) {
                          var simple = type.slice( 0, 3 ) !== "nth",
                              forward = type.slice( -4 ) !== "last",
                              ofType = what === "of-type";
              
              
              Severity: Major
              Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

                Function Deferred has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    Deferred: function( func ) {
                        var tuples = [
                                // action, add listener, listener list, final state
                                [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
                                [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
                Severity: Major
                Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                                          if ( forward && useCache ) {
                                              // Seek `elem` from a previously-cached index
                                              outerCache = parent[ expando ] || (parent[ expando ] = {});
                                              cache = outerCache[ type ] || [];
                                              nodeIndex = cache[0] === dirruns && cache[1];
                  Severity: Critical
                  Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

                    Cyclomatic complexity is too high in method box. (9)
                    Open

                        def box(self, instance, instance_type, val):
                            if val is None:
                                return None
                            elif isinstance(val, string_types):
                                raise ValidationError("Attempted to assign a string to ListField {0}"
                    Severity: Minor
                    Found in auxlib/entity.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 find_packages. (9)
                    Open

                    def find_packages(where='.', exclude=()):
                        out = []
                        stack = [(convert_path(where), '')]
                        while stack:
                            where, prefix = stack.pop(0)
                    Severity: Minor
                    Found in auxlib/packaging.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 __new__. (9)
                    Open

                        def __new__(mcs, name, bases, dct):
                            # if we're about to mask a field that's already been created with something that's
                            #  not a field, then assign it to an alternate variable name
                            non_field_keys = (key for key, value in iteritems(dct)
                                              if not isinstance(value, Field) and not key.startswith('__'))
                    Severity: Minor
                    Found in auxlib/entity.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 ajaxConvert has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function ajaxConvert( s, response, jqXHR, isSuccess ) {
                        var conv2, current, conv, tmp, prev,
                            converters = {},
                            // Work with a copy of dataTypes in case we need to modify it for conversion
                            dataTypes = s.dataTypes.slice();
                    Severity: Major
                    Found in docs/_theme/basic/static/jquery-1.11.1.js - About 2 hrs to fix

                      Cyclomatic complexity is too high in method validate. (8)
                      Open

                          def validate(self, instance, val):
                              """
                      
                              Returns:
                                  True: if val is valid
                      Severity: Minor
                      Found in auxlib/entity.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

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

                          def __init__(self, element_type, default=NULL, required=True, validation=None,
                                       in_dump=True, default_in_dump=True, nullable=False, immutable=False, aliases=()):
                              self._element_type = element_type
                              super(ListField, self).__init__(default, required, validation,
                                                              in_dump, default_in_dump, nullable, immutable, aliases)
                      Severity: Major
                      Found in auxlib/entity.py and 1 other location - About 2 hrs to fix
                      auxlib/entity.py on lines 648..653

                      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 52.

                      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

                      Cyclomatic complexity is too high in function typify_data_structure. (8)
                      Open

                      def typify_data_structure(value, type_hint=None):
                          if isinstance(value, Mapping):
                              return type(value)((k, typify(v, type_hint)) for k, v in iteritems(value))
                          elif isiterable(value):
                              return type(value)(typify(v, type_hint) for v in value)
                      Severity: Minor
                      Found in auxlib/type_coercion.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