shoponrails/clots

View on GitHub

Showing 17 of 19 total issues

Method set_primary_attributes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def set_primary_attributes(context)
      @item = context['form_model']
      if @item
        @attribute_name =  resolve_value(@params.shift,context)
        @first_attr = context['form_class_name']
Severity: Minor
Found in lib/clot/model_form_tags.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

File date_tags.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'clot/date_tags'
require 'clot/no_model_form_tags'

module Clot

Severity: Minor
Found in lib/clot/date_tags.rb - About 2 hrs to fix

    Method activate has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.activate
          %w(
              clot/active_record/droppable.rb
              clot/base_drop.rb
              clot/if_content_for.rb
    Severity: Major
    Found in lib/clot_engine.rb - About 2 hrs to fix

      Method apply_params has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def apply_params(params, context)
            params.each do |pair|
              pair_data = pair.split ":"
              case pair_data[0]
                when "label" then
      Severity: Major
      Found in lib/clot/nav_bar.rb - About 2 hrs to fix

        Method set_primary_attributes has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def set_primary_attributes(context)
              @item = context['form_model']
              if @item
                @attribute_name =  resolve_value(@params.shift,context)
                @first_attr = context['form_class_name']
        Severity: Minor
        Found in lib/clot/model_form_tags.rb - About 1 hr to fix

          Method render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def render(context)
                if @attributes.has_key?('url_helper')
                  Protected.config = context.registers[:controller]
                  @attributes['url'] = Protected.send(@attributes['url_helper'].to_sym) unless @attributes.has_key?('url_helper_params')
                  if params = context[@attributes['url_helper_params']]
          Severity: Minor
          Found in lib/clot/form_for.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 apply_params has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def apply_params(params, context)
                params.each do |pair|
                  pair_data = pair.split ":"
                  case pair_data[0]
                    when "label" then
          Severity: Minor
          Found in lib/clot/nav_bar.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 personal_attributes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def personal_attributes(name,value)
                case name
                  when "discard_day" then
                    @discard_day = true
                  when "include_blank" then
          Severity: Minor
          Found in lib/clot/date_tags.rb - About 1 hr to fix

            Method set_attributes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_attributes(context)
                  set_primary_attributes(context)
            
                  @params.each do |pair|
                    pair.match /([^:]*):(.*)/
            Severity: Minor
            Found in lib/clot/no_model_form_tags.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 liquify has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.liquify(current_context, *records, &block)
                  i = -1
                  records =
                  records.inject [] do |all, r|
                    i+=1
            Severity: Minor
            Found in lib/clot/base_drop.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 value_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def value_string(val)
                  if @use_month_numbers
                    super(val)
                  else
                    if @use_month_names
            Severity: Minor
            Found in lib/clot/date_tags.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 set_form_action has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_form_action(context)
                  if @attributes.has_key?('ur_helper')
                    Protected.config = context.registers[:controller]
            
                    if @attributes['object'].nil?
            Severity: Minor
            Found in lib/clot/form_for.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 get_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_options(from_val,to_val, selected_value = nil)
                  options = ""
            
                  if from_val < to_val
                    range = (from_val..to_val)
            Severity: Minor
            Found in lib/clot/date_tags.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def render(context)
                  @params = @_params.clone
                  @model = context[@params.shift]
            
                  if @model and @model.respond_to?(:errors) and @model.errors.count > 0
            Severity: Minor
            Found in lib/clot/form_for.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 form_select_item has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def form_select_item(name, value, collection, errors, blank_option = nil)
            Severity: Minor
            Found in lib/clot/form_filters.rb - About 35 mins to fix

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

                  def render(context)
                    if @naked_yield
                      return context['content_for_layout']
                    else
                      partial = Liquid::Template.load_theme(context, @template_name)
              Severity: Minor
              Found in lib/clot/yield.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def render(context)
                    @tag_factory = context['tag_factory']
                    tag_generator(@params, context)
                    LinkItem.has_predecessor ||= {}
                    separator = ""
              Severity: Minor
              Found in lib/clot/nav_bar.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