crowdAI/crowdai

View on GitHub

Showing 178 of 178 total issues

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

  def confirmation_instructions(record, token, opts={})
    options = {
      participant_id:   record.id,
      subject:          "crowdAI Confirmation Instructions",
      email:            record.email,
Severity: Minor
Found in app/mailers/devise_mandrill_mailer.rb and 2 other locations - About 35 mins to fix
app/mailers/devise_mandrill_mailer.rb on lines 4..21
app/mailers/devise_mandrill_mailer.rb on lines 44..61

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 35.

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 footer_class has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def footer_class
    if controller.controller_name == 'registrations' ||
       (controller.controller_name == 'challenges' && controller.action_name == 'edit') ||
       (controller.controller_name == 'organizers' && controller.action_name == 'edit') ||
       (controller.controller_name == 'sessions')
Severity: Minor
Found in app/helpers/application_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 media_fields_present? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def media_fields_present?
    media_large = params[:media_large]
    media_thumbnail = params[:media_thumbnail]
    media_content_type = params[:media_content_type]
    unless (media_large.present? && media_thumbnail.present? && media_content_type.present?) || (media_large.blank? && media_thumbnail.blank? && media_content_type.blank?)
Severity: Minor
Found in app/controllers/api/external_graders_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 3 locations. Consider refactoring.
Open

  def reset_password_instructions(record, token, opts={})
    options = {
      participant_id:   record.id,
      subject:          "crowdAI Password Reset",
      email:            record.email,
Severity: Minor
Found in app/mailers/devise_mandrill_mailer.rb and 2 other locations - About 35 mins to fix
app/mailers/devise_mandrill_mailer.rb on lines 24..41
app/mailers/devise_mandrill_mailer.rb on lines 44..61

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 35.

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 3 locations. Consider refactoring.
Open

  def unlock_instructions(record, token, opts={})
    options = {
      participant_id:   record.id,
      subject:          "crowdAI Unlock Instructions",
      email:            record.email,
Severity: Minor
Found in app/mailers/devise_mandrill_mailer.rb and 2 other locations - About 35 mins to fix
app/mailers/devise_mandrill_mailer.rb on lines 4..21
app/mailers/devise_mandrill_mailer.rb on lines 24..41

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 35.

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

    create_table :submission_grades do |t|
      t.references :submission, index: true, foreign_key: true
      t.string :grading_status_cd
      t.string :grading_message
      t.float :grading_factor
doc/technical/archived_migrations/20160812160955_create_docker_configurations.rb on lines 3..12

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 33.

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

    create_table :docker_configurations do |t|
      t.references :challenge, index: true, foreign_key: true
      t.string :container
      t.string :mount_point
      t.boolean :existing_mount_point
doc/technical/archived_migrations/20160531083247_create_submission_grades.rb on lines 3..11

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 33.

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

Avoid too many return statements within this method.
Open

      return false
Severity: Major
Found in app/controllers/api/external_graders_controller.rb - About 30 mins to fix

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

        $('a#toggle-user').click(function(e) {
       e.preventDefault();
           $('#user-container').toggleClass("open");
         });
    Severity: Minor
    Found in app/assets/javascripts/modules/site.js and 2 other locations - About 30 mins to fix
    app/assets/javascripts/modules/site.js on lines 5..8
    app/assets/javascripts/modules/site.js on lines 54..57

    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

    Avoid too many return statements within this function.
    Open

                return node.value.replace(/^\s+|\s+$/g, '');
    Severity: Major
    Found in app/assets/javascripts/modules/sorttable.js - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return false # no positive condition met
      Severity: Major
      Found in app/policies/challenge_policy.rb - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return innerText.replace(/^\s+|\s+$/g, '');
        Severity: Major
        Found in app/assets/javascripts/modules/sorttable.js - About 30 mins to fix

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

               $('.mde-img a').click(function(e) {
                  e.preventDefault();
                  $(".mde-img input").trigger('click');
               });
          Severity: Minor
          Found in app/assets/javascripts/modules/site.js and 2 other locations - About 30 mins to fix
          app/assets/javascripts/modules/site.js on lines 5..8
          app/assets/javascripts/modules/site.js on lines 38..41

          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

          Avoid too many return statements within this method.
          Open

                return youtube
          Severity: Major
          Found in app/concepts/leaderboard/cells/media.rb - About 30 mins to fix

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

                 $('a#mobile-nav').click(function(e) {
                   e.preventDefault();
                   $('.mobile-primary').toggleClass("open");
                 });
            Severity: Minor
            Found in app/assets/javascripts/modules/site.js and 2 other locations - About 30 mins to fix
            app/assets/javascripts/modules/site.js on lines 38..41
            app/assets/javascripts/modules/site.js on lines 54..57

            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

            Avoid too many return statements within this method.
            Open

                    return true #return true if running and no clef challenge
            Severity: Major
            Found in app/policies/challenge_policy.rb - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return node.text.replace(/^\s+|\s+$/g, '');
              Severity: Major
              Found in app/assets/javascripts/modules/sorttable.js - About 30 mins to fix

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

                  if(radioValue === 'crowdAI') {
                    $('#dataset-file-s3-key').show();
                    $('#external-url').hide();
                    $('#dataset_file_external_file_size').hide();
                  } else {
                Severity: Minor
                Found in app/assets/javascripts/controllers/dataset_files_controller.js and 1 other location - About 30 mins to fix
                app/assets/javascripts/controllers/dataset_files_controller.js on lines 7..11

                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

                  } else {
                    $('#dataset-file-s3-key').hide();
                    $('#external-url').show();
                    $('#dataset_file_external_file_size').show();
                  }
                Severity: Minor
                Found in app/assets/javascripts/controllers/dataset_files_controller.js and 1 other location - About 30 mins to fix
                app/assets/javascripts/controllers/dataset_files_controller.js on lines 3..7

                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 3 locations. Consider refactoring.
                Open

                  class Scope
                    attr_reader :participant, :scope
                
                    def initialize(participant, scope)
                      @participant = participant
                Severity: Minor
                Found in app/policies/participant_policy.rb and 2 other locations - About 25 mins to fix
                app/policies/member_policy.rb on lines 32..49
                app/policies/organizer_policy.rb on lines 47..64

                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

                Severity
                Category
                Status
                Source
                Language