colinschoen/enrollme

View on GitHub

Showing 9 of 572 total issues

Class AdminsController has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class AdminsController < ApplicationController
  skip_before_filter :authenticate, :only => ['new', 'create']
  before_filter :validate_admin, :set_admin, :except => ['new', 'create']

  def new
Severity: Minor
Found in app/controllers/admins_controller.rb - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

      if (time.month == 5 or time.month == 6 or (time.month == 4 and time.day >= 15) or (time.month == 7 and time.day <= 15) or 
          (time.month == 10 and time.day >= 15) or (time.month == 11 and time.day <= 15))
        puts "Sending Emails to Admins..."
        AdminMailer.send_look_at_submission
        puts "done." 
    Severity: Critical
    Found in script/clock.rb - About 2 hrs to fix

      Method delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def delete
          if @admin.superadmin == true
            c = 0
            for a in Admin.all
              if params.has_key? "delete_#{a.name}"
      Severity: Minor
      Found in app/controllers/admins_controller.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 skills_str has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def skills_str
          if talents.nil? || talents.length.zero?
            return ''
          end
          skills = []
      Severity: Minor
      Found in app/models/user.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

      Consider simplifying this complex logical expression.
      Open

        if ((time.month == 7 and time.day > 15) or (time.month == 8 and time.day <= 15) or
            (time.month == 11 and time.day > 15) or time.month == 12)
          puts "Sending Emails to Admins..."
          AdminMailer.send_look_at_submission
          puts "done." 
      Severity: Major
      Found in script/clock.rb - About 1 hr to fix

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

          def create
            oauth_hash = Rails.env.test? ? OmniAuth.config.mock_auth[:google] : env["omniauth.auth"]
            user = User.user_from_oauth(oauth_hash)
            admin = Admin.admin_from_oauth(oauth_hash)
            session[:user_email] = oauth_hash[:info][:email]
        Severity: Minor
        Found in app/controllers/session_controller.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def create
                @user = User.find_by_id(session[:user_id])
                @team = Team.find_by_id(@user.team.id)
                
                d1 = submission_params[:disc1id]
        Severity: Minor
        Found in app/controllers/submissions_controller.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

        Consider simplifying this complex logical expression.
        Open

          if ((time.month == 8 and time.day > 15) or time.month == 9 or
              time.month == 1 or (time.month == 2 and time.day <= 20))
            puts "Sending Emails to Admins..."
            AdminMailer.send_look_at_submission
            puts "done." 
        Severity: Major
        Found in script/clock.rb - About 40 mins to fix

          Avoid too many return statements within this method.
          Open

                  return Team.all.each
          Severity: Major
          Found in app/models/team.rb - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language