rails-girls-summer-of-code/rgsoc-teams

View on GitHub

Showing 62 of 62 total issues

Class ApplicationData has 60 methods (exceeds 20 allowed). Consider refactoring.
Open

class ApplicationData
  def initialize(data)
    @data = data || {}
  end

Severity: Major
Found in app/models/application_data.rb - About 1 day to fix

    Class User has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class User < ApplicationRecord
      include EmailPreferences
    
      TSHIRT_SIZES = %w(XXS XS S M L XL 2XL 3XL)
      TSHIRT_CUTS = %w(Straight Fitted)
    Severity: Minor
    Found in app/models/user.rb - About 4 hrs to fix

      Class Team has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Team < ApplicationRecord
        include HasSeason
        include ProfilesHelper
      
        KINDS = %w(full_time part_time)
      Severity: Minor
      Found in app/models/team.rb - About 3 hrs to fix

        Class Application has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Application
            include ActiveModel::Model
        
            attr_accessor :id,
                          :team_name,
        Severity: Minor
        Found in app/models/mentor/application.rb - About 2 hrs to fix

          Method initialize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def initialize(user)
              user ||= User.new
          
              alias_action :create, :read, :update, :destroy, to: :crud
          
          
          Severity: Minor
          Found in app/models/ability.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 initialize has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def initialize(user)
              user ||= User.new
          
              alias_action :create, :read, :update, :destroy, to: :crud
          
          
          Severity: Major
          Found in app/models/ability.rb - About 2 hrs to fix

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

              def update
                source.update_attributes!(title: discover_title) unless source.title.present?
                source.feed_url = discover_feed_url unless source.feed_url.present?
                update_entries
                source.save! if source.feed_url_changed? && source.feed_url != source.url
            Severity: Minor
            Found in lib/feed.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 update_entries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def update_entries
                parse.entries.each do |data|
                  item = Item.new(source.url, source.team_id, data)
                  raise "can not find guid for item in source #{source.feed_url}" unless item.guid
                  # logger.info "processing item #{item.guid}: #{item.title}"
            Severity: Minor
            Found in lib/feed.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

            Function addFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                addFields: function(e) {
                  // Setup
                  var link      = e.currentTarget;
                  var assoc     = $(link).data('association');                // Name of child
                  var blueprint = $('#' + $(link).data('blueprint-id'));
            Severity: Minor
            Found in app/assets/javascripts/nested_form.js - About 1 hr to fix

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

                def update
                  respond_to do |format|
                    if @user.update_attributes(user_params)
                      notice = nil
                      # We disabled the confirmation instruction sending in the omniauth
              Severity: Minor
              Found in app/controllers/users_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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  respond_to do |format|
                    if @team.save
                      format.html { redirect_to @team, notice: 'Team was successfully created.' }
                      format.json { render action: :show, status: :created, location: @team }
                    else
              Severity: Minor
              Found in app/controllers/roles_controller.rb and 1 other location - About 55 mins to fix
              app/controllers/teams_controller.rb on lines 43..49

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 44.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  respond_to do |format|
                    if @team.save
                      format.html { redirect_to @team, notice: 'Team was successfully created.' }
                      format.json { render action: :show, status: :created, location: @team }
                    else
              Severity: Minor
              Found in app/controllers/teams_controller.rb and 1 other location - About 55 mins to fix
              app/controllers/roles_controller.rb on lines 18..24

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 44.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                def set_application_dates
                  return if year.blank?
                  self.starts_at ||= Time.utc(year, *SUMMER_OPEN) # 1 jul
                  self.ends_at ||= Time.utc(year, *SUMMER_CLOSE)  # 30 sept
                  self.applications_open_at  ||= Time.utc(year, *APPL_OPEN)
              Severity: Minor
              Found in app/models/season.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 index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def index
                    @display_roles = (Role::TEAM_ROLES + ['supervisor']).map(&:pluralize)
              
                    if params[:sort]
                      direction = params[:direction] == 'asc' ? 'ASC' : 'DESC'
              Severity: Minor
              Found in app/controllers/organizers/teams_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 confirm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def confirm
                  @role = Role.where.not(confirmation_token: nil).find_by! confirmation_token: params[:id]
                  @team = @role.team
                  respond_to do |format|
                    if @role.pending?
              Severity: Minor
              Found in app/controllers/roles_controller.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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          content = content.replace(
                            new RegExp('(_' + parentNames[i] + ')_.+?_', 'g'),
                            '$1_' + parentIds[i] + '_');
              Severity: Minor
              Found in app/assets/javascripts/nested_form.js and 1 other location - About 30 mins to fix
              app/assets/javascripts/nested_form.js on lines 33..35

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          content = content.replace(
                            new RegExp('(\\[' + parentNames[i] + '\\])\\[.+?\\]', 'g'),
                            '$1[' + parentIds[i] + ']');
              Severity: Minor
              Found in app/assets/javascripts/nested_form.js and 1 other location - About 30 mins to fix
              app/assets/javascripts/nested_form.js on lines 29..31

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                def json_params
                  {
                    only: [:github_handle, :avatar_url, :location, :country, :twitter_handle],
                    methods: [:name_or_handle],
                    include: [
              Severity: Minor
              Found in app/controllers/contributors_controller.rb and 1 other location - About 25 mins to fix
              app/controllers/students_controller.rb on lines 17..27

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 31.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                def json_params
                  {
                    only: [:github_handle, :avatar_url, :location, :country, :twitter_handle],
                    methods: [:name_or_handle],
                    include: [
              Severity: Minor
              Found in app/controllers/students_controller.rb and 1 other location - About 25 mins to fix
              app/controllers/contributors_controller.rb on lines 17..27

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 31.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                def new
                  if !current_user.confirmed?
                    redirect_to root_path, alert: 'You need to click on the link in the email to confirm your account before you can create an application.'
                  elsif current_user.student?
                    redirect_to root_path, alert: 'You need to have a partner in your team to create an application.' unless current_team.try(:confirmed?)
              Severity: Minor
              Found in app/controllers/application_drafts_controller.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