saasbook/ruql

View on GitHub

Showing 18 of 25 total issues

Method render_fill_in has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  def render_fill_in(question)
    @b.question :type => 'GS_Short_Answer_Question_Simple', :id => question.object_id.to_s(16) do
      @b.metadata {
        @b.parameters {
          @b.rescale_score question.points
Severity: Minor
Found in lib/ruql/renderers/xml_renderer.rb - About 5 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 render_fill_in has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def render_fill_in(q, idx)
    render_question_text(q, idx) do
      if @show_solutions
        answer = q.answers[0]
        if answer.has_explanation?
Severity: Minor
Found in lib/ruql/renderers/html_form_renderer.rb - About 4 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 render_multiple_choice has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def render_multiple_choice(question)
    # the OLX for select-multiple and select-one are frustratingly different in arbitrary ways
    # single choice has <multiplechoiceresponse> element containing a <choicegroup> with <choice>s
    # select-mult has <choiceresponse> element containing a <checkboxgroup> with <choice>s

Severity: Minor
Found in lib/ruql/renderers/edxml_renderer.rb - About 3 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 render_open_assessment has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def render_open_assessment(question)
    @b.openassessment url_name: question.url_name,
                      submission_start: "#{question.submission_start.to_s}T"\
                                        "#{question.submission_start_time}:00+00:00",
                      submission_due: "#{question.submission_due.to_s}T"\
Severity: Major
Found in lib/ruql/renderers/edxml_renderer.rb - About 2 hrs to fix

    Class Quiz has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Quiz
      @@quizzes = []
      @@options = {}
    
      attr_reader :renderer
    Severity: Minor
    Found in lib/ruql/quiz.rb - About 2 hrs to fix

      Method render_dropdown has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def render_dropdown(question)
          @b.problem do
            if question.raw?
              @b.p { |p| p << question.question_text }
            else
      Severity: Minor
      Found in lib/ruql/renderers/edxml_renderer.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 render_question_text has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def render_question_text(question,index)
          html_args = {
            :id => "question-#{index}",
            :class => ['question', question.class.to_s.downcase, (question.multiple ? 'multiple' : '')]
              .join(' ')
      Severity: Minor
      Found in lib/ruql/renderers/html_form_renderer.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 render_multiple_choice has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def render_multiple_choice(question)
          # the OLX for select-multiple and select-one are frustratingly different in arbitrary ways
          # single choice has <multiplechoiceresponse> element containing a <choicegroup> with <choice>s
          # select-mult has <choiceresponse> element containing a <checkboxgroup> with <choice>s
      
      
      Severity: Minor
      Found in lib/ruql/renderers/edxml_renderer.rb - About 1 hr to fix

        Method render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def render(question, index, type='')    
            output = ''
            output << "\\begin{question#{type}}{q#{index}}\n"
            output << "  \\scoring{b=#{question.points},m=#{@penalty*question.points}}\n"
            if type == 'mult'
        Severity: Minor
        Found in lib/ruql/renderers/auto_qcm_renderer.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 render_fill_in has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def render_fill_in(question)
            @b.question :type => 'GS_Short_Answer_Question_Simple', :id => question.object_id.to_s(16) do
              @b.metadata {
                @b.parameters {
                  @b.rescale_score question.points
        Severity: Minor
        Found in lib/ruql/renderers/xml_renderer.rb - About 1 hr to fix

          Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def initialize(options={}, yaml={})
              @peer_review = options[:peer_review] || false
              @self_assessment = options[:self_assessment]
              @self_assessment = true if @self_assessment.nil?
          
          
          Severity: Minor
          Found in lib/ruql/open_assessment/open_assessment.rb - About 1 hr to fix

            Method render_answer_for_solutions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              def render_answer_for_solutions(answer,raw)
                args = {:class => (answer.correct? ? 'correct' : 'incorrect')}
                @h.li(args) do
                  if raw then @h.p { |p| p << answer.answer_text } else @h.p answer.answer_text  end
                  if answer.has_explanation?
            Severity: Minor
            Found in lib/ruql/renderers/html_form_renderer.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 render_quiz has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def render_quiz
                if @template
                  render_with_template do
                    render_questions
                    @output
            Severity: Minor
            Found in lib/ruql/renderers/html_form_renderer.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 render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def render(question, index, type='')    
                output = ''
                output << "\\begin{question#{type}}{q#{index}}\n"
                output << "  \\scoring{b=#{question.points},m=#{@penalty*question.points}}\n"
                if type == 'mult'
            Severity: Minor
            Found in lib/ruql/renderers/auto_qcm_renderer.rb - About 1 hr to fix

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

                def render_multiple_choice(q,index)
                  render_question_text(q, index) do
                    answers =
                      if q.class == TrueFalse then q.answers.sort.reverse # True always first
                      elsif q.randomize then q.answers.sort_by { rand }
              Severity: Minor
              Found in lib/ruql/renderers/html_form_renderer.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

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

                def render_open_assessment(question)
                  @b.openassessment url_name: question.url_name,
                                    submission_start: "#{question.submission_start.to_s}T"\
                                                      "#{question.submission_start_time}:00+00:00",
                                    submission_due: "#{question.submission_due.to_s}T"\
              Severity: Minor
              Found in lib/ruql/renderers/edxml_renderer.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

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

                def render_select_multiple(q,index)
                  render_question_text(q, index) do
                    answers =
                      if q.randomize then q.answers.sort_by { rand }
                  else q.answers
              Severity: Minor
              Found in lib/ruql/renderers/html_form_renderer.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 render_multiple_choice_answer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def render_multiple_choice_answer(answer, multiple_allowed)
                  option_args = {}
                  option_args['selected_score'] = answer.correct? ? 1 : 0
                  option_args['unselected_score'] =
                    multiple_allowed ? 1 - option_args['selected_score'] : 0
              Severity: Minor
              Found in lib/ruql/renderers/xml_renderer.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