concord-consortium/rigse

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

Summary

Maintainability
A
4 hrs
Test Coverage

Method find_grade_level has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def find_grade_level(params)
    grade_level = Portal::GradeLevel.find_by_name('9')
    if @portal_clazz
      # Try to get a grade level from the class first.
      if (!(grade_levels = @portal_clazz.grade_levels).nil? && grade_levels.size > 0)
Severity: Minor
Found in rails/app/helpers/signup_helper.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

Method security_question has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def security_question(number)
    result = <<-EOF
    <div class = 'f-row'>
      <ui-select ng-model="regCtrl.questions[#{number}]"
        name="questions[#{number}]"  theme="select2"
Severity: Minor
Found in rails/app/helpers/signup_helper.rb - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

            grade_level = grade_levels[0] if grade_levels[0]
    Severity: Major
    Found in rails/app/helpers/signup_helper.rb - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status