SmartBear/ruby-handlebars

View on GitHub

Showing 5 of 5 total issues

Method apply_as has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def apply_as(context, arguments = [], as_arguments = [], block = [], else_block = [])
Severity: Minor
Found in lib/ruby-handlebars/helper.rb - About 35 mins to fix

    Method apply_as has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def self.apply_as(context, data, name, block, else_block)
    Severity: Minor
    Found in lib/ruby-handlebars/helpers/with_helper.rb - About 35 mins to fix

      Method apply_as has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def self.apply_as(context, items, name, block, else_block)
      Severity: Minor
      Found in lib/ruby-handlebars/helpers/each_helper.rb - About 35 mins to fix

        Method get_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_attribute(item, attribute)
              sym_attr = attribute.to_sym
              str_attr = attribute.to_s
        
              if item.respond_to?(:[]) && item.respond_to?(:has_key?)
        Severity: Minor
        Found in lib/ruby-handlebars/context.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

        Method apply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.apply(context, condition, block, else_block)
                condition = !condition.empty? if condition.respond_to?(:empty?)
        
                unless condition
                  block.fn(context)
        Severity: Minor
        Found in lib/ruby-handlebars/helpers/unless_helper.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