razum2um/lurker

View on GitHub

Showing 330 of 330 total issues

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

function renderXJSLiteral(object, isLast, state, start, end) {
Severity: Minor
Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 35 mins to fix

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

    function _writeDouble (buf, value, offset, littleEndian, noAssert) {
    Severity: Minor
    Found in lib/lurker/templates/javascripts/JSXTransformer.js - About 35 mins to fix

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

              createForStatement: function (init, test, update, body) {
                  return {
                      type: Syntax.ForStatement,
                      init: init,
                      test: test,
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 2 other locations - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 3343..3351
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 3534..3542

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

      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 3 locations. Consider refactoring.
      Open

              createTypeAnnotation: function (typeIdentifier, paramTypes, returnType, nullable) {
                  return {
                      type: Syntax.TypeAnnotation,
                      id: typeIdentifier,
                      paramTypes: paramTypes,
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 2 other locations - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 3271..3279
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 3534..3542

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

      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 3 locations. Consider refactoring.
      Open

              createTryStatement: function (block, guardedHandlers, handlers, finalizer) {
                  return {
                      type: Syntax.TryStatement,
                      block: block,
                      guardedHandlers: guardedHandlers,
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 2 other locations - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 3271..3279
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 3343..3351

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

      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

        exports.encode = function base64_encode(aNumber) {
          if (aNumber in intToCharMap) {
            return intToCharMap[aNumber];
          }
          throw new TypeError("Must be between 0 and 63: " + aNumber);
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 8234..8239

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

      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

        resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
          return !!p;
        }), !resolvedAbsolute).join('/');
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 1479..1481

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

      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

        path = normalizeArray(filter(path.split('/'), function(p) {
          return !!p;
        }), !isAbsolute).join('/');
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 1465..1467

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

      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

        exports.decode = function base64_decode(aChar) {
          if (aChar in charToIntMap) {
            return charToIntMap[aChar];
          }
          throw new TypeError("Not a valid base 64 digit: " + aChar);
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 8224..8229

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

      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

      Method read has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def read
              return YAML.load_file(@path) unless @path.match(/\.erb$/)
      
              context = Lurker::ErbSchemaContext.new
              erb = ERB.new(IO.read @path).result(context.get_binding)
      Severity: Minor
      Found in lib/lurker/json/reader.rb - 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

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

            def merge!(schema)
              case parent_schema
              when Lurker::Json::Object
                parent_schema[Json::PROPERTIES][parent_property] = @parser.typed.parse(schema)
              when Lurker::Json::List
      Severity: Minor
      Found in lib/lurker/json/schema/polymorph.rb - 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

      Method safe_require has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.safe_require(gem, desc=nil)
          begin
            require gem
          rescue LoadError => e
            $stderr.puts(e.message)
      Severity: Minor
      Found in lib/lurker.rb - 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

      Method to_html has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def to_html(parent_key=nil)
          html = StringIO.new
      
          html << '<span class="deprecated">Deprecated</span>' if deprecated?
      
      
      Severity: Minor
      Found in lib/lurker/presenters/schema_presenter.rb - 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

      Method gem_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def gem_info
            spec = if Bundler.respond_to? :locked_gems
                     Bundler.locked_gems.specs.select { |s| s.name == 'lurker' }.first # 1.6
                   else
                     Bundler.definition.sources.detect { |s| s.specs.map(&:name).include?('lurker') } # 1.3
      Severity: Minor
      Found in lib/lurker/cli.rb - 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

      Method create_by_supposition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def create_by_supposition(payload)
                if payload.key?(Json::ITEMS)
                  Lurker::Json::List.new(payload, schema_options)
                elsif payload.key?(Json::PROPERTIES)
                  Lurker::Json::Object.new(payload, schema_options)
      Severity: Minor
      Found in lib/lurker/json/parser/typed_strategy.rb - 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

      Method process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def process(*)
                  super.tap do
                    if Lurker::Spy.enabled?
                      [:@request, :@response].each do |iv_name|
                        if !instance_variable_defined?(iv_name) || instance_variable_get(iv_name).nil?
      Severity: Minor
      Found in lib/lurker/spec_helper/rails.rb - 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

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

        return (node.type === Syntax.FunctionDeclaration
                || node.type === Syntax.FunctionExpression
                || node.type === Syntax.ArrowFunctionExpression)
               && node.rest;
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 2974..2977

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

      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

            if (substitution.type === Syntax.Identifier ||
                substitution.type === Syntax.MemberExpression ||
                substitution.type === Syntax.CallExpression) {
              utils.catchup(substitution.range[1], state);
            } else {
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 4651..4653

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

      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

                  if (expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression) {
                      throwError({}, Messages.InvalidLHSInAssignment);
                  }
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 11669..11678

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

      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

                      } else if (extra.tokens[extra.openCurlyToken - 4] &&
                              extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {
                          // Named function.
                          checkToken = extra.tokens[extra.openCurlyToken - 5];
                          if (!checkToken) {
      Severity: Minor
      Found in lib/lurker/templates/javascripts/JSXTransformer.js and 1 other location - About 35 mins to fix
      lib/lurker/templates/javascripts/JSXTransformer.js on lines 3006..3022

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

      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

      Severity
      Category
      Status
      Source
      Language