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 = []
- Read upRead up
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
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");
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
- Read upRead up
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
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 ||= []
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]
- Read upRead up
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]
- Read upRead up
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
- Read upRead up
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
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
- Read upRead up
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]}"
- Read upRead up
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
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
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
File enrollments_controller.rb
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
class EnrollmentsController < ApplicationController
include EnrollmentSearchConcern
include SharedPdfConcern
authorize_resource
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}"
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
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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"