gems-uff/sapos

View on GitHub

Showing 283 of 383 total issues

Method search_table has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def search_table(pdf, options = {})
    search ||= options[:search]

    return if search.blank?
    values = []
Severity: Minor
Found in app/helpers/enrollments_pdf_helper.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

File pdf_helper.rb has 336 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "prawn/measurement_extensions"

module PdfHelper
  include ApplicationHelper

Severity: Minor
Found in app/helpers/pdf_helper.rb - About 4 hrs to fix

    Function carrierwave_webcam has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function carrierwave_webcam(div) {
      let id = $(div).data("id");
      let url = $(div).data("url");
      let basename = $(div).data("basename");
      let column = $(div).data("column");
    Severity: Major
    Found in app/assets/javascripts/form_widgets/carrierwave_webcam_widget.js - About 3 hrs to fix

      Method grade_for_situation has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def grade_for_situation
            if course_has_grade
              unless self.grade.blank?
                self.errors.add(:grade, :grade_gt_100) if self.grade > 100
                self.errors.add(:grade, :grade_lt_0) if self.grade < 0
      Severity: Minor
      Found in app/models/class_enrollment.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

      Class AdmissionProcessesController has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Admissions::AdmissionProcessesController < ApplicationController
        authorize_resource
        include ApplicationHelper
        include PdfHelper
      
      
      Severity: Minor
      Found in app/controllers/admissions/admission_processes_controller.rb - About 3 hrs to fix

        Method prepare_class_schedule_table has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def prepare_class_schedule_table(
            course_classes, on_demand, advisement_authorizations = nil,
            keep_on_demand = false, used_to_render_a_pdf_report: false
          )
            advisement_authorizations ||= []
        Severity: Major
        Found in app/helpers/concerns/class_schedule_helper_concern.rb - About 3 hrs to fix

          Method grades_report_table has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            def grades_report_table(pdf, options = {})
              enrollment ||= options[:enrollment]
              total_class_enrollments ||= options[:class_enrollments]
          
              table_width = [66, 215, 57, 57, 50, 50, 65]
          Severity: Minor
          Found in app/helpers/enrollments_pdf_helper.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 transcript_table has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            def transcript_table(pdf, options = {})
              class_enrollments ||= options[:class_enrollments]
          
              table_width = [66, 280, 57, 57, 50, 50]
          
          
          Severity: Minor
          Found in app/helpers/enrollments_pdf_helper.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 assign_multiparameter_attributes has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def assign_multiparameter_attributes(pairs)
                self.class.defined_month_years.each do |attribute|
                  found_day = nil
                  found_month = nil
                  found_year = nil
          Severity: Minor
          Found in app/models/concerns/month_year_concern.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

          File email_template.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class EmailTemplate < ApplicationRecord
            has_paper_trail
          
            validates_uniqueness_of :name, allow_blank: true
            validates :body, presence: true
          Severity: Minor
          Found in app/models/email_template.rb - About 3 hrs to fix

            Method validate_value has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              def validate_value(val)
                unless val.to_s.empty?
                  case value_type
                  when VALUE_DATE
                    begin
            Severity: Minor
            Found in app/models/query_param.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 custom_condition_for_accomplishments_column has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def custom_condition_for_accomplishments_column(column, value, like_pattern)
                  return "" if value[:phase].blank?
                  date = value.nil? ? value : "#{value[:year]}-#{
                    (value[:month].size == 1) ? "0" + value[:month] : value[:month]
                  }-#{(value[:day].size == 1) ? "0" + value[:day] : value[:day]}"
            Severity: Minor
            Found in app/controllers/concerns/enrollment_search_concern.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

            File enrollments_helper.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module EnrollmentsHelper
              include PdfHelper
              include EnrollmentsPdfHelper
            
              include EnrollmentHelperConcern
            Severity: Minor
            Found in app/helpers/enrollments_helper.rb - About 3 hrs to fix

              File enrollment_request.rb has 296 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class EnrollmentRequest < ApplicationRecord
                attr_accessor :valid_insertion, :valid_removal, :student_saving
                has_paper_trail
              
                belongs_to :enrollment, optional: false
              Severity: Minor
              Found in app/models/enrollment_request.rb - About 3 hrs to fix

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

                class EnrollmentRequest < ApplicationRecord
                  attr_accessor :valid_insertion, :valid_removal, :student_saving
                  has_paper_trail
                
                  belongs_to :enrollment, optional: false
                Severity: Minor
                Found in app/models/enrollment_request.rb - About 3 hrs to fix

                  File enrollments_controller.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  class EnrollmentsController < ApplicationController
                    include EnrollmentSearchConcern
                    include SharedPdfConcern
                  
                    authorize_resource
                  Severity: Minor
                  Found in app/controllers/enrollments_controller.rb - About 3 hrs to fix

                    Method header has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def header(pdf, title, pdf_config, options = {}, &block)
                        if pdf_config.nil?
                          # report, transcript, grades_report, schedule
                          type = options[:pdf_type] || :report
                          pdf_type = :"use_at_#{type}"
                    Severity: Major
                    Found in app/helpers/pdf_helper.rb - About 2 hrs to fix

                      Method if_scholarship_is_not_with_another_student has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def if_scholarship_is_not_with_another_student
                          return if scholarship.nil?
                          durations = ScholarshipDuration.where(scholarship_id: scholarship.id)
                          durations = durations.where.not(id: self.id) if self.id.present?
                          scholarships_with_student = durations.all
                      Severity: Minor
                      Found in app/models/scholarship_duration.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 prepare_table has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def prepare_table(admission_process)
                          applications = admission_process.admission_applications.filter do |application|
                            next false if !self.show_partial_candidates && !application.filled_form.is_filled
                            # Consolidate
                            field_objects = nil
                      Severity: Minor
                      Found in app/models/admissions/admission_report_config.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 admission_applications_table has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def admission_applications_table(curr_pdf, options = {})
                          admission_process ||= options[:admission_process]
                          admission_report_config = @admission_report_config || Admissions::AdmissionReportConfig.new.init_default
                          title = admission_process_pdf_title(admission_process)
                          config = admission_report_config.prepare_table(admission_process)
                      Severity: Minor
                      Found in app/helpers/admissions/admission_processes_pdf_helper.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

                      Severity
                      Category
                      Status
                      Source
                      Language