ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

Method view_team has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def view_team
    @participant = AssignmentParticipant.find(params[:id])
    @assignment = @participant.assignment
    @team = @participant.team
    @team_id = @team.id
Severity: Minor
Found in app/controllers/grades_controller.rb - About 1 hr to fix

    Block has too many lines. [35/25]
    Open

        keys.each do |key|
          questionnaire = Questionnaire.find(@review_final_versions[key][:questionnaire_id])
          questions = Question.where(questionnaire_id: questionnaire.id)
    
          # Loops by each question per review round
    Severity: Minor
    Found in app/controllers/popup_controller.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [35/25]
    Open

        context 'when attributes are not nil and at least one assignment_questionnaire\'s id is nil or blank' do
          let(:attributes) { [assignment_questionnaire, assignment_questionnaire2] }
          before(:each) do
            allow(assignment_questionnaire).to receive(:[]).with(:id).and_return(nil)
            allow(assignment_questionnaire).to receive(:[]).with(:questionnaire_weight).and_return(0)
    Severity: Minor
    Found in spec/models/assignment_form_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [35/25]
    Open

      describe "POST #children_node_ng" do
        before(:each) do
          @treefolder = TreeFolder.new
          @treefolder.parent_id = nil
          @treefolder.name = "Courses"

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [35/25]
    Open

      context 'when current assignment is a team-based assignment with topics' do
        context 'when a student access studet_task#list page of this assignment' do
          it 'contains \'Your team\' link on the page'
        end
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        init:function(automodeperiod){
            var persistedtab=ddajaxtabs.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
            var selectedtab=-1 //Currently selected tab index (-1 meaning none)
            var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
            this.automodeperiod=automodeperiod || 0
    Severity: Minor
    Found in app/assets/javascripts/ajaxtabs.js - About 1 hr to fix

      Method classify_controllers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def classify_controllers
          from_classes = SiteController.classes
      
          from_db = SiteController.order(:name)
          known = {}
      Severity: Minor
      Found in app/controllers/site_controllers_controller.rb - About 1 hr to fix

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

          factory :topic_due_date, class: TopicDueDate do
            due_at DateTime.now.in_time_zone + 1.day
            deadline_type { DeadlineType.first || association(:deadline_type) }
            topic { SignUpTopic.first || association(:topic) }
            submission_allowed_id 3
        Severity: Major
        Found in spec/factories/factories.rb and 1 other location - About 1 hr to fix
        spec/factories/factories.rb on lines 289..304

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

        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

          factory :assignment_due_date, class: AssignmentDueDate do
            due_at DateTime.now.in_time_zone + 1.day
            deadline_type { DeadlineType.first || association(:deadline_type) }
            assignment { Assignment.first || association(:assignment) }
            submission_allowed_id 3
        Severity: Major
        Found in spec/factories/factories.rb and 1 other location - About 1 hr to fix
        spec/factories/factories.rb on lines 307..322

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

        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 get has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.get(sortvar = nil, sortorder = nil, user_id = nil, show = nil, parent_id = nil, _search = nil)
            conditions = if show
                           if User.find(user_id).role.name != "Teaching Assistant"
                             'questionnaires.instructor_id = ?'
                           else
        Severity: Minor
        Found in app/models/questionnaire_node.rb - About 1 hr to fix

          Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render: function() {
                var renderContent = []
                var formStyle = {
                  margin: 0,
                  padding: 0,
          Severity: Minor
          Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

            Function GenCell has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function GenCell(pValue,pHighLight,pColor)//Generate table cell with value
            {
                var PValue;
                var PCellStr;
                var vColor;
            Severity: Minor
            Found in app/assets/javascripts/datetimepicker.js - About 1 hr to fix

              Method find_team_participants has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.find_team_participants(assignment_id, ip_address = nil)
                  @participants = SignedUpTeam.joins('INNER JOIN sign_up_topics ON signed_up_teams.topic_id = sign_up_topics.id')
                                              .select('signed_up_teams.id as id, sign_up_topics.id as topic_id, sign_up_topics.topic_name as name,
                                                sign_up_topics.topic_name as team_name_placeholder, sign_up_topics.topic_name as user_name_placeholder,
                                                signed_up_teams.is_waitlisted as is_waitlisted, signed_up_teams.team_id as team_id')
              Severity: Minor
              Found in app/models/signed_up_team.rb - About 1 hr to fix

                Method new_quiz has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def new_quiz
                    valid_request = true
                    @assignment_id = params[:aid] # creating an instance variable to hold the assignment id
                    @participant_id = params[:pid] # creating an instance variable to hold the participant id
                    assignment = Assignment.find(@assignment_id)
                Severity: Minor
                Found in app/controllers/questionnaires_controller.rb - About 1 hr to fix

                  Method show has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def show
                      @id = params[:id]
                      @model = params[:model]
                      @options = params[:options]
                      @delimiter = get_delimiter(params)
                  Severity: Minor
                  Found in app/controllers/import_file_controller.rb - About 1 hr to fix

                    Function connect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ddajaxtabs.connect=function(pageurl, tabinstance){
                        var page_request = false
                        var bustcacheparameter=""
                        if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
                            try {
                    Severity: Minor
                    Found in app/assets/javascripts/ajaxtabs.js - 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 contributor_to_review has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def contributor_to_review(reviewer, topic)
                        raise 'Please select a topic' if topics? && topic.nil?
                        raise 'This assignment does not have topics' if !topics? && topic
                        # This condition might happen if the reviewer waited too much time in the
                        # select topic page and other students have already selected this topic.
                    Severity: Minor
                    Found in app/models/review_assignment.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 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update(attributes, user)
                        @has_errors = false
                        has_late_policy = false
                        if attributes[:assignment][:late_policy_id].to_i > 0
                          has_late_policy = true
                    Severity: Minor
                    Found in app/models/assignment_form.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 col_sort has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function col_sort(m) {
                        lesser = !lesser
                        // Swaps two columns of the table
                        jQuery.moveColumn = function (table, from, to) {
                            var rows = jQuery('tr', table);
                    Severity: Minor
                    Found in app/assets/javascripts/view_team_in_grades.js - 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 export has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.export(csv, parent_id, options)
                        where(parent_id: parent_id).find_each do |part|
                          tcsv = []
                          user = part.user
                          tcsv.push(user.name, user.fullname, user.email) if options["personal_details"] == "true"
                    Severity: Minor
                    Found in app/models/participant.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

                    Severity
                    Category
                    Status
                    Source
                    Language