ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

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

  def self.get_similarity_1xn(comparison_id, filename)
    full_url = @@base_uri + '/similarity_1xn/' + comparison_id
    json_body = {"filename" => filename}.to_json
    RestClient::Request.execute(method: :get,
                                url: full_url,
Severity: Minor
Found in app/models/simicheck_webservice.rb and 1 other location - About 35 mins to fix
app/models/simicheck_webservice.rb on lines 120..132

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

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 questionnaire_options(assignment, type, _round = 0)
    questionnaires = Questionnaire.where(['private = 0 or instructor_id = ?', assignment.instructor_id]).order('name')
    options = []
    questionnaires.select {|x| x.type == type }.each do |questionnaire|
      options << [questionnaire.name, questionnaire.id]
Severity: Minor
Found in app/helpers/assignment_helper.rb and 1 other location - About 35 mins to fix
spec/features/assignment_creation_spec.rb on lines 1..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 34.

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

  def move_up
    @menu_item = MenuItem.find(params[:id])
    @above = @menu_item.above

    if @above
Severity: Minor
Found in app/controllers/menu_items_controller.rb and 1 other location - About 35 mins to fix
app/controllers/menu_items_controller.rb on lines 124..134

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

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 (this.GetMonthName(false)+DateSeparator+pDate+DateSeparator+this.Year);
Severity: Major
Found in app/assets/javascripts/datetimepicker.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              return (a_val.localeCompare(b_val))
    Severity: Major
    Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return 1;
      Severity: Major
      Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return -1;
        Severity: Major
        Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return name
          Severity: Major
          Found in app/models/team.rb - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return (this.toUTCString());
            Severity: Major
            Found in app/assets/javascripts/datetimepicker.js - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return nil
              Severity: Major
              Found in app/models/team.rb - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return 0;
                Severity: Major
                Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

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

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Unprotected mass assignment
                        Open

                            @question = Question.new(params[:question])

                        Mass assignment is a feature of Rails which allows an application to create a record from the values of a hash.

                        Example:

                        User.new(params[:user])

                        Unfortunately, if there is a user field called admin which controls administrator access, now any user can make themselves an administrator.

                        attr_accessible and attr_protected can be used to limit mass assignment. However, Brakeman will warn unless attr_accessible is used, or mass assignment is completely disabled.

                        There are two different mass assignment warnings which can arise. The first is when mass assignment actually occurs, such as the example above. This results in a warning like

                        Unprotected mass assignment near line 61: User.new(params[:user])

                        The other warning is raised whenever a model is found which does not use attr_accessible. This produces generic warnings like

                        Mass assignment is not restricted using attr_accessible

                        with a list of affected models.

                        In Rails 3.1 and newer, mass assignment can easily be disabled:

                        config.active_record.whitelist_attributes = true

                        Unfortunately, it can also easily be bypassed:

                        User.new(params[:user], :without_protection => true)

                        Brakeman will warn on uses of without_protection.

                        Potentially dangerous attribute available for mass assignment
                        Open

                        class TeamUserNode < Node
                        Severity: Minor
                        Found in app/models/team_user_node.rb by brakeman

                        Mass assignment is a feature of Rails which allows an application to create a record from the values of a hash.

                        Example:

                        User.new(params[:user])

                        Unfortunately, if there is a user field called admin which controls administrator access, now any user can make themselves an administrator.

                        attr_accessible and attr_protected can be used to limit mass assignment. However, Brakeman will warn unless attr_accessible is used, or mass assignment is completely disabled.

                        There are two different mass assignment warnings which can arise. The first is when mass assignment actually occurs, such as the example above. This results in a warning like

                        Unprotected mass assignment near line 61: User.new(params[:user])

                        The other warning is raised whenever a model is found which does not use attr_accessible. This produces generic warnings like

                        Mass assignment is not restricted using attr_accessible

                        with a list of affected models.

                        In Rails 3.1 and newer, mass assignment can easily be disabled:

                        config.active_record.whitelist_attributes = true

                        Unfortunately, it can also easily be bypassed:

                        User.new(params[:user], :without_protection => true)

                        Brakeman will warn on uses of without_protection.

                        Mass assignment is not restricted using attr_accessible
                        Open

                        class AssignmentBadge < ActiveRecord::Base
                        Severity: Critical
                        Found in app/models/assignment_badge.rb by brakeman

                        This warning comes up if a model does not limit what attributes can be set through mass assignment.

                        In particular, this check looks for attr_accessible inside model definitions. If it is not found, this warning will be issued.

                        Brakeman also warns on use of attr_protected - especially since it was found to be vulnerable to bypass. Warnings for mass assignment on models using attr_protected will be reported, but at a lower confidence level.

                        Note that disabling mass assignment globally will suppress these warnings.

                        Mass assignment is not restricted using attr_accessible
                        Open

                        class AssignmentNode < Node
                        Severity: Critical
                        Found in app/models/assignment_node.rb by brakeman

                        This warning comes up if a model does not limit what attributes can be set through mass assignment.

                        In particular, this check looks for attr_accessible inside model definitions. If it is not found, this warning will be issued.

                        Brakeman also warns on use of attr_protected - especially since it was found to be vulnerable to bypass. Warnings for mass assignment on models using attr_protected will be reported, but at a lower confidence level.

                        Note that disabling mass assignment globally will suppress these warnings.

                        Mass assignment is not restricted using attr_accessible
                        Open

                        class AuthorFeedbackQuestionnaire < Questionnaire

                        This warning comes up if a model does not limit what attributes can be set through mass assignment.

                        In particular, this check looks for attr_accessible inside model definitions. If it is not found, this warning will be issued.

                        Brakeman also warns on use of attr_protected - especially since it was found to be vulnerable to bypass. Warnings for mass assignment on models using attr_protected will be reported, but at a lower confidence level.

                        Note that disabling mass assignment globally will suppress these warnings.

                        Mass assignment is not restricted using attr_accessible
                        Open

                        class ColumnHeader < QuestionnaireHeader
                        Severity: Critical
                        Found in app/models/column_header.rb by brakeman

                        This warning comes up if a model does not limit what attributes can be set through mass assignment.

                        In particular, this check looks for attr_accessible inside model definitions. If it is not found, this warning will be issued.

                        Brakeman also warns on use of attr_protected - especially since it was found to be vulnerable to bypass. Warnings for mass assignment on models using attr_protected will be reported, but at a lower confidence level.

                        Note that disabling mass assignment globally will suppress these warnings.

                        Severity
                        Category
                        Status
                        Source
                        Language