comfy/comfy-bootstrap-form

View on GitHub

Showing 22 of 22 total issues

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

    def submit(value = nil, options = {}, &block)
      if value.is_a?(Hash)
        options = value
        value   = nil
      end
Severity: Minor
Found in lib/comfy_bootstrap_form/form_builder.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 draw_input_group_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def draw_input_group_content(bootstrap, type)
      value = bootstrap.send(type)
      return unless value.present?

      content_tag(:div, class: "input-group-#{type}") do
Severity: Minor
Found in lib/comfy_bootstrap_form/form_builder.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