razum2um/lurker

View on GitHub

Showing 330 of 330 total issues

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

  if (!noAssert) {
    assert(value !== undefined && value !== null, 'missing value')
    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
    assert(offset !== undefined && offset !== null, 'missing offset')
    assert(offset + 3 < buf.length, 'trying to write beyond buffer length')
Severity: Major
Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 2 hrs to fix
lib/lurker/templates/javascripts/JSXTransformer.js on lines 693..699

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

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 parseStatement has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function parseStatement() {
        var type = lookahead.type,
            expr,
            labeledBody,
            key;
Severity: Major
Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

    Class Endpoint has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Endpoint
        include Lurker::Utils
    
        PREFIX = 'prefix'.freeze
        ACTION = 'action'.freeze
    Severity: Minor
    Found in lib/lurker/endpoint.rb - About 2 hrs to fix

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

          function skipComment() {
              var ch, blockComment, lineComment;
      
              blockComment = false;
              lineComment = false;
      Severity: Major
      Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

        Function unpatch has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function unpatch() {
                if (typeof extra.skipComment === 'function') {
                    skipComment = extra.skipComment;
                }
        
        
        Severity: Major
        Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

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

                      if (match('[')) {
                          expr = delegate.createMemberExpression('[', expr, parseComputedMember());
                      } else if (match('.')) {
                          expr = delegate.createMemberExpression('.', expr, parseNonComputedMember());
                      } else {
          Severity: Major
          Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 2 hrs to fix
          lib/lurker/templates/javascripts/JSXTransformer.js on lines 4369..4375

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

          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

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

                      } else if (match('[')) {
                          expr = delegate.createMemberExpression('[', expr, parseComputedMember());
                      } else if (match('.')) {
                          expr = delegate.createMemberExpression('.', expr, parseNonComputedMember());
                      } else {
          Severity: Major
          Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 2 hrs to fix
          lib/lurker/templates/javascripts/JSXTransformer.js on lines 4388..4394

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

          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 _renderClassBody has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function _renderClassBody(traverse, node, path, state) {
            var className = state.className;
            var superClass = state.superClass;
          
            // Set up prototype of constructor on same line as `extends` for line-number
          Severity: Major
          Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

            Function SourceNode_fromStringWithSourceMap has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) {
                  // The SourceNode we want to fill with the generated code
                  // and the SourceMap
                  var node = new SourceNode();
            
            
            Severity: Major
            Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

              Function wrapTrackingFunction has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function wrapTrackingFunction(range, loc, preserveWhitespace) {
              
                      return function (parseFunction) {
              
                          function isBinary(node) {
              Severity: Major
              Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

                Function SourceNode_toStringWithSourceMap has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
                    var generated = {
                      code: "",
                      line: 1,
                      column: 0
                Severity: Major
                Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

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

                      function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
                        var generatedLine = 1;
                        var previousGeneratedColumn = 0;
                        var previousOriginalLine = 0;
                        var previousOriginalColumn = 0;
                  Severity: Major
                  Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

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

                        function parseArrayInitialiser() {
                            var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true, body;
                    
                            expect('[');
                            while (!match(']')) {
                    Severity: Major
                    Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                            else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
                                     && aOriginal && 'line' in aOriginal && 'column' in aOriginal
                                     && aGenerated.line > 0 && aGenerated.column >= 0
                                     && aOriginal.line > 0 && aOriginal.column >= 0
                                     && aSource) {
                      Severity: Critical
                      Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

                        Function 28 has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        },{"./xjs":29,"esprima-fb":6,"jstransform/src/utils":20}],28:[function(_dereq_,module,exports){
                        /**
                         * Copyright 2013-2014 Facebook, Inc.
                         *
                         * Licensed under the Apache License, Version 2.0 (the "License");
                        Severity: Major
                        Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

                          Function parsePrimaryExpression has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function parsePrimaryExpression() {
                                  var type, token;
                          
                                  token = lookahead;
                                  type = lookahead.type;
                          Severity: Major
                          Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

                            Function traverse has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function traverse(node, path, state) {
                              // Create a scope stack entry if this is the first node we've encountered in
                              // its local scope
                              var parentNode = path[0];
                              if (!Array.isArray(node) && state.localScope.parentNode !== parentNode) {
                            Severity: Major
                            Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

                              Function 10 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              },{"./util":16,"amdefine":17}],10:[function(_dereq_,module,exports){
                              /* -*- Mode: js; js-indent-level: 2; -*- */
                              /*
                               * Copyright 2011 Mozilla Foundation and contributors
                               * Licensed under the New BSD license. See LICENSE or:
                              Severity: Major
                              Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 2 hrs to fix

                                Method apply_form_for_options! has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def apply_form_for_options!(record, object, options) #:nodoc:
                                        object = convert_to_model(object)
                                
                                        as = options[:as]
                                        action, method = object.respond_to?(:persisted?) && object.persisted? ? [:edit, :patch] : [:new, :post]
                                Severity: Minor
                                Found in templates/rails32_http_patch_support.rb - About 2 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

                                Method filtering_block has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def filtering_block
                                        if options['select'].present?
                                          select = /#{options['select']}/
                                        end
                                
                                
                                Severity: Minor
                                Found in lib/lurker/cli.rb - About 2 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

                                Severity
                                Category
                                Status
                                Source
                                Language