concord-consortium/rigse

View on GitHub
rails/app/helpers/runnables_helper.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

  def x_link_for(component, verb, as_name = nil, params = {})
    link_text = params.delete(:link_text) || "#{verb} "
    url = run_url_for(component, params, params.delete(:format))

    run_type = case component
Severity: Minor
Found in rails/app/helpers/runnables_helper.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 student_run_buttons has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def student_run_buttons(offering,opts={})
    default_solo_label = display_workgroups_run_link?(offering) ? "Run by Myself" : "Run"
    solo_label      = opts[:solo_text]  || default_solo_label
    group_label     = opts[:group_label]|| "Run with Other Students"
    options         = popup_options_for(offering)
Severity: Minor
Found in rails/app/helpers/runnables_helper.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 x_button_for has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def x_button_for(component, verb, image = verb, params = {}, run_as = nil)
Severity: Minor
Found in rails/app/helpers/runnables_helper.rb - About 35 mins to fix

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

      def popup_options_for(component,_options={})
        options = _options.dup
        if component.is_a?(ExternalActivity)
          options[:target] = '_blank' if component.popup
        elsif component.is_a?(Portal::Offering) && component.external_activity?
    Severity: Minor
    Found in rails/app/helpers/runnables_helper.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 run_url_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def run_url_for(component, params = {}, format = nil)
        if component.instance_of? Interactive
          return component.url
        end
    
    
    Severity: Minor
    Found in rails/app/helpers/runnables_helper.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 x_button_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def x_button_for(component, verb, image = verb, params = {}, run_as = nil)
    
        unless run_as
          run_as = case component
          when ExternalActivity then ExternalActivity.display_name
    Severity: Minor
    Found in rails/app/helpers/runnables_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

    There are no issues that match your filters.

    Category
    Status