judofyr/temple

View on GitHub

Showing 32 of 34 total issues

Method on_multi has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

      def on_multi(*exps)
        result = [:multi]
        curr = nil
        prev = []
        state = :looking
Severity: Minor
Found in lib/temple/filters/dynamic_inliner.rb - About 3 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 chain_proc_constructor has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def chain_proc_constructor(name, filter)
        raise(ArgumentError, 'Proc or blocks must have arity 0 or 1') if filter.arity > 1
        method_name = "FILTER #{name}"
        c = Class === self ? self : singleton_class
        filter = c.class_eval { define_method(method_name, &filter); instance_method(method_name) }
Severity: Minor
Found in lib/temple/mixins/engine_dsl.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 chain_element has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def chain_element(args, block)
        name = args.shift
        if Class === name
          filter = name
          name = filter.name.to_sym
Severity: Minor
Found in lib/temple/mixins/engine_dsl.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 call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def call(input)
        result = [:multi]
        pos = 0
        input.scan(ERB_PATTERN) do |token, indicator, code|
          text = input[pos...$~.begin(0)]
Severity: Minor
Found in lib/temple/erb/parser.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 on_multi has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def on_multi(*exps)
        result = [:multi]
        code = nil

        exps.each do |exp|
Severity: Minor
Found in lib/temple/filters/code_merger.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 on_html_attrs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def on_html_attrs(*attrs)
        values = {}

        attrs.each do |_, _, name, value|
          name = name.to_s
Severity: Minor
Found in lib/temple/html/attribute_merger.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 on_html_tag has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def on_html_tag(name, attrs, content = nil)
        return super unless @pretty

        name = name.to_s
        closed = !content || (empty_exp?(content) && options[:autoclose].include?(name))
Severity: Minor
Found in lib/temple/html/pretty.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 Rule has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def Rule(rule)
        case rule
        when Rule
          rule
        when Symbol, Class, true, false, nil
Severity: Minor
Found in lib/temple/mixins/grammar_dsl.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 on_multi has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def on_multi(*exps)
        result = [:multi]
        text = nil

        exps.each do |exp|
Severity: Minor
Found in lib/temple/filters/static_merger.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 static? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def static?(code)
        return false if code.nil? || code.strip.empty?
        return false if syntax_error?(code)

        Ripper.lex(code).each do |_, token, str|
Severity: Minor
Found in lib/temple/static_analyzer.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 shift_balanced_embexpr has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

          def shift_balanced_embexpr(tokens)
            String.new.tap do |embedded|
              embexpr_open = 1

              until tokens.empty?
Severity: Minor
Found in lib/temple/filters/string_splitter.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 on_multi has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def on_multi(*exps)
        result = [:multi]
        curr = nil
        prev = []
        state = :looking
Severity: Minor
Found in lib/temple/filters/dynamic_inliner.rb - About 1 hr to fix

    Method compile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

            def compile(level = 0, call_parent = nil)
              call_method = method ? (level == 0 ? "#{method}(*exp)" :
                                      "#{method}(*exp[#{level}..-1])") : call_parent
              if empty?
                raise 'Invalid dispatcher node' unless method
    Severity: Minor
    Found in lib/temple/mixins/dispatcher.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 call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def call(s)
            if options[:encoding] && s.respond_to?(:encoding)
              old_enc = s.encoding
              s = s.dup if s.frozen?
              s.force_encoding(options[:encoding])
    Severity: Minor
    Found in lib/temple/filters/encoding.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 on_html_attrs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def on_html_attrs(*attrs)
            values = {}
    
            attrs.each do |_, _, name, value|
              name = name.to_s
    Severity: Minor
    Found in lib/temple/html/attribute_merger.rb - About 1 hr to fix

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

            def on_multi(*exps)
              exps = exps.dup
              result = [:multi]
              buffer = []
      
      
      Severity: Minor
      Found in lib/temple/filters/dynamic_merger.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize(opts = {})
              super
              @format = options[:format]
              unless [:xhtml, :html, :xml].include?(@format)
                if @format == :html4 || @format == :html5
      Severity: Minor
      Found in lib/temple/html/fast.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 compile_tokens! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

                def compile_tokens!(exps, tokens)
                  beg_str, end_str = strip_quotes!(tokens)
      
                  until tokens.empty?
                    _, type, str = tokens.shift
      Severity: Minor
      Found in lib/temple/filters/string_splitter.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 call has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def call(input)
              result = [:multi]
              pos = 0
              input.scan(ERB_PATTERN) do |token, indicator, code|
                text = input[pos...$~.begin(0)]
      Severity: Minor
      Found in lib/temple/erb/parser.rb - About 1 hr to fix

        Method Rule has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def Rule(rule)
                case rule
                when Rule
                  rule
                when Symbol, Class, true, false, nil
        Severity: Minor
        Found in lib/temple/mixins/grammar_dsl.rb - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language