concord-consortium/rigse

View on GitHub

Showing 1,200 of 2,137 total issues

Function loop has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  loop: function(timePos) {
    if (timePos >= this.startOn) {
      if (timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
Severity: Minor
Found in rails/app/assets/javascripts/effects.js - 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 populateMaterialData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def populateMaterialData
    material = self.material
    user = self.user


Severity: Minor
Found in rails/app/models/search/search_material.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 in_render_scope? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def in_render_scope?(thing)
    return true if thing == nil
    if already_rendered?(thing)
      return true
    end
Severity: Minor
Found in rails/app/helpers/application_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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    @offering = Portal::Offering.find(params[:id])
    authorize @offering

    respond_to do |format|
Severity: Minor
Found in rails/app/controllers/portal/offerings_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

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

  def is_project_researcher?(project = nil, allow_expired: false, check_can_manage_permission_forms: false)
    target_association = allow_expired ? _project_user_researchers_inc_expired : _project_user_researchers

    if check_can_manage_permission_forms
      if project
Severity: Minor
Found in rails/app/models/user.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

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

    Method default_report_for_offering has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.default_report_for_offering(offering)
        return nil unless offering.runnable
        return nil unless offering.runnable.respond_to?(:tool)
        return nil unless offering.runnable.tool
        source_type = offering.runnable.tool.source_type
    Severity: Minor
    Found in rails/app/models/default_report_service.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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def show
    
        type            = params[:material_type]
        id              = params[:id]
        include_related = params.has_key?(:include_related)     ?
    Severity: Minor
    Found in rails/app/controllers/api/v1/materials_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

    Method add_materials_standard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_materials_standard
    
        key     = ENV['ASN_API_KEY']
        uri     = params[:identifier]
        type    = params[:material_type]
    Severity: Minor
    Found in rails/app/controllers/api/v1/materials_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

    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

    Avoid deeply nested control flow statements.
    Open

            if user
              peer = Client.find_by_app_secret(token)
              if peer
                return [user, {:learner => nil, :teacher => nil}]
              else
    Severity: Major
    Found in rails/app/controllers/api/api_controller.rb - About 45 mins to fix

      Method sort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def sort
          auth = auth_teacher(params)
          return error(auth[:error]) if auth[:error]
          user = auth[:user]
      
      
      Severity: Minor
      Found in rails/app/controllers/api/v1/teacher_classes_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

      Method external_report_query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def external_report_query
          authorize [:api, :v1, :report_user]
      
          teacher_ids = []
          if params[:teachers] && !params[:teachers].empty?
      Severity: Minor
      Found in rails/app/controllers/api/v1/report_users_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

      Method edit_menu_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def edit_menu_for(component, form, options={:omit_cancel => true}, scope=false)
          component = (component.respond_to? :embeddable) ? component.embeddable : component
          capture_haml do
            haml_tag :div, :class => 'action_menu' do
              haml_tag :div, :class => 'action_menu_header_left' do
      Severity: Minor
      Found in rails/app/helpers/application_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 switch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def switch
          @user = User.find(params[:id])
          authorize @user
          if params[:commit] == "Switch"
            if switch_to_user = User.find(params[:user][:id])
      Severity: Minor
      Found in rails/app/controllers/users_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

      Avoid deeply nested control flow statements.
      Open

                  if params[:user][:has_projects_in_form]
                    expiration_dates = params[:user][:project_expiration_dates] || {}
                    can_manage_permission_forms = params[:user][:project_can_manage_permission_forms] || {}
                    @user.set_role_for_projects('researcher', current_visitor.admin_for_projects, params[:user][:researcher_project_ids] || [], expiration_dates, can_manage_permission_forms)
                  end
      Severity: Major
      Found in rails/app/controllers/users_controller.rb - About 45 mins to fix

        Method soft_truncate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def soft_truncate(string, length, soft_limit=nil)
            return '' unless string
            string.strip!
            return string if string.length <= length
            firstpart = string[0..(length-1)]
        Severity: Minor
        Found in rails/lib/truncatable_xhtml.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 boolean_param has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def boolean_param(symbol)
                boolvalue = params[symbol]
        
                if boolvalue.class == String
                  boolvalue = false if (boolvalue =~ /false/i)
        Severity: Minor
        Found in rails/lib/controller_param_utils.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def initialize(file, options = {}, attachment = nil)
            @file = file
            @target_geometry = (options[:geometry] && options[:geometry] !~ /#/) ? Paperclip::Geometry.parse(options[:geometry]) : Paperclip::Geometry.from_file(@file)
            @whiny = options[:whiny].nil? ? true : options[:whiny]
            @attach = attachment.instance
        Severity: Minor
        Found in rails/lib/paperclip_processors/attributor_overlay.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 update_teacher_info_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_teacher_info_fields
              self.teachers_district = clazz.teachers.map{ |t| t.schools.map{ |s| s.district ? s.district.name : nil }.join(", ")}.join(", ")
              self.teachers_state = clazz.teachers.map{ |t| t.schools.map{ |s| s.district ? s.district.state : nil}.join(", ")}.join(", ")
              self.teachers_email = clazz.teachers.map{ |t| t.user.email}.join(", ")
              save!
        Severity: Minor
        Found in rails/db/migrate/20160629104824_add_teacher_info_to_report_learner.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

        Severity
        Category
        Status
        Source
        Language