redjazz96/liquidscript

View on GitHub

Showing 10 of 12 total issues

Class Javascript has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Javascript < Base
      module Literals

        BINOP_SWITCH = {
          "=="  => "===",
Severity: Minor
Found in lib/liquidscript/generator/javascript/literals.rb - About 3 hrs to fix

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

        class ICR < Base
          module Literals
    
            def compile_number
              n = shift(:number)
    Severity: Minor
    Found in lib/liquidscript/compiler/icr/literals.rb - About 2 hrs to fix

      Method compile_class has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def compile_class
                delegate_if_class do
                  shift :class
                  name    = shift :identifier
                  inherit = nil
      Severity: Minor
      Found in lib/liquidscript/compiler/icr/classes.rb - About 1 hr to fix

        Method _compile_group has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def _compile_group(type, cond = false, continue = false)
                  shift type
        
                  if cond ||= block_given?
                    shift :lparen
        Severity: Minor
        Found in lib/liquidscript/compiler/icr/groups.rb - About 1 hr 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 _exec_context has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def _exec_context(code)
                  out = buffer
        
                  out << "#{indent}\"use strict\";\n" if code[:strict]
                  unless code.locals.empty?
        Severity: Minor
        Found in lib/liquidscript/generator/javascript/metas.rb - About 55 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 out has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def out(v)
                if v.is_a?(Representable) || v.is_a?(Array)
                  @depth += 1
                  body = ["\n", " " * @depth, "(",
                    v.to_a.map {|d| out(d) }.compact.join(' '),
        Severity: Minor
        Found in lib/liquidscript/icr/sexp.rb - About 45 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 normalize_arguments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def normalize_arguments(args)
                  hash = if args.last.is_a? Hash
                    args.pop.dup
                  else
                    {}
        Severity: Minor
        Found in lib/liquidscript/compiler/base/helpers.rb - About 45 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 _build_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def _build_element(body, options, opts, part)
                  k, v = part
        
                  type = if k.is_a? Symbol then k else k.type end
        
        
        Severity: Minor
        Found in lib/liquidscript/generator/javascript/objects.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 replace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def replace(code, options = {})
                  method_name = :"generate_#{code.type}"
        
                  if method(method_name).arity.abs == 1
                    send(method_name, code)
        Severity: Minor
        Found in lib/liquidscript/generator/base/replacements.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 lex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def lex(*args)
                  args.flatten!
                  to_lex = args.pop
        
                  context, body = if to_lex.is_a? Hash
        Severity: Minor
        Found in lib/liquidscript/scanner/base/lexer.rb - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Severity
        Category
        Status
        Source
        Language