Rademade/rademade_admin

View on GitHub

Showing 23 of 27 total issues

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

        def localizable?(localizable = true)
          if !@form_params.nil? && @form_params.has_key?(:localize)
            @form_params[:localize] == localizable
          else
            return !localizable unless has_field?
Severity: Minor
Found in lib/rademade_admin/model/info/data_item.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 active? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def active?(menu_item)
    if menu_item[:is_current]
      true
    else
      menu_item[:sub].each do |sub_item|
Severity: Minor
Found in app/helpers/rademade_admin/menu_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

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

          def collect_where_condition(where_conditions, result)
            where_method = WHERE_METHOD_MAP[where_conditions.type]
            where_conditions.parts.each do |part|
              if part.is_a? RademadeAdmin::Search::Part::Where
                result = result.send(where_method, where_sub_condition(part))
Severity: Minor
Found in lib/rademade_admin/model/adapter/query/mongoid.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