Showing 40 of 93 total issues
Method raw_records
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def raw_records
base_relation
.select(
<<-SQL
users.*,
Function onCreate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
patchNoteFunctions.onCreate = function () {
try {
const patchNoteList = $('#patch-note-list')
const newPatchNoteFormInputs = patchNoteFunctions.getPatchNoteFormInputs($('#new-patch-note'))
Function createPatchNote
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
patchNoteFunctions.createPatchNote = function (patchNoteGroupId, patchNoteText, patchNoteTypeId) {
// Input check
TypeChecker.checkPositiveInteger(patchNoteGroupId, 'patchNoteGroupId')
TypeChecker.checkPositiveInteger(patchNoteTypeId, 'patchNoteTypeId')
TypeChecker.checkString(patchNoteText, 'patchNoteText')
Function addPatchNoteUI
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
patchNoteFunctions.addPatchNoteUI = function (patchNoteGroupId, patchNoteId, patchNoteList, patchNoteText, patchNoteTypeId) {
TypeChecker.checkPositiveInteger(patchNoteGroupId, 'patchNoteGroupId')
TypeChecker.checkPositiveInteger(patchNoteId, 'patchNoteId')
TypeChecker.checkPositiveInteger(patchNoteTypeId, 'patchNoteTypeId')
TypeChecker.checkNonEmptyJQueryObject(patchNoteList, 'patchNoteList')
Method import_cases
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def import_cases
import do |row|
casa_case_params = row.to_hash.slice(:case_number, :birth_month_year_youth).compact
unless casa_case_params.key?(:case_number)
- 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
Function formatTimestampsAsBubbleChartData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function formatTimestampsAsBubbleChartData (timestamps) {
const bubbleDataAsObject = {}
for (const timestamp of timestamps) {
const contactCreationTime = new Date(timestamp * 1000)
- 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 update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update
authorize @case_contact
params[:case_contact][:status] = step.to_s if !@case_contact.active? && params.key?(:case_contact)
remove_unwanted_contact_types
remove_nil_draft_ids
- 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 import_volunteers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def import_volunteers
import do |row|
volunteer_params = row.to_hash.slice(:display_name, :email, :phone_number).compact
unless volunteer_params.key?(:email)
- 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 process_casa_case_date
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_casa_case_date(cc, import_date, case_number, already_has_nonmatching_date, no_edit_made, updated_casa_cases, case_not_found)
Method valid_phone_number
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def valid_phone_number(number)
message = "must be 10 digits or 12 digits including country code (+1)"
if number.nil? || number.empty?
return true, 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 create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize CaseAssignment
if existing_case_assignment.present?
if existing_case_assignment.update(active: true)
- 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 record_outdated?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def record_outdated?(record, new_data)
new_data.each do |key, value|
# The parser keeps boolean values as strings
if record[key] != value || (value == ((record[key].in?([true, false]) && record[key]) ? "FALSE" : "TRUE"))
return true
- 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
Function addPatchNoteUI
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
patchNoteFunctions.addPatchNoteUI = function (patchNoteGroupId, patchNoteId, patchNoteList, patchNoteText, patchNoteTypeId) {
Method update_casa_case_dates_of_birth
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_casa_case_dates_of_birth(data, case_not_found, already_has_nonmatching_date, no_edit_made, updated_casa_cases)
Method generate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate
authorize CaseCourtReport
casa_case = CasaCase.find_by(case_number: case_params[:case_number], casa_org: current_user.casa_org)
respond_to do |format|
- 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 apply_occurred_at_filter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply_occurred_at_filter(key, query)
return query if params[:occurred_at][key].empty?
query.where(
(key == :end) ? "? >= occurred_at" : "occurred_at >= ?",
- 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 activate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def activate
authorize @volunteer
if @volunteer.activate
VolunteerMailer.account_setup(@volunteer).deliver
- 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 process_casa_case_date
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_casa_case_date(cc, import_date, case_number, already_has_nonmatching_date, no_edit_made, updated_casa_cases, case_not_found)
if cc&.birth_month_year_youth
if !dates_match(cc, d2)
already_has_nonmatching_date << {case_number: case_number, prev_date: cc.birth_month_year_youth, import_date: d2}
else
- 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 perform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perform
CSV.generate(headers: true) do |csv|
csv << full_data.keys.map(&:to_s).map(&:titleize)
if casa_cases.present?
casa_cases.decorate.each do |casa_case|
- 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 validate_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_file(file, import_type)
# Validate that file is attached
if file.blank?
return {type: :error, message: ERR_FILE_NOT_ATTACHED}
end
- 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"