Showing 45 of 100 total issues
Method import_supervisors
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def import_supervisors
import do |row|
supervisor_params = row.to_hash.slice(:display_name, :email, :phone_number).compact
unless supervisor_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
Function savePatchNote
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
patchNoteFunctions.savePatchNote = function (patchNoteGroupId, patchNoteId, patchNoteText, patchNoteTypeId) {
// Input check
TypeChecker.checkPositiveInteger(patchNoteGroupId, 'patchNoteGroupId')
TypeChecker.checkPositiveInteger(patchNoteId, 'patchNoteGroupId')
TypeChecker.checkPositiveInteger(patchNoteTypeId, 'patchNoteTypeId')
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'))
Method raw_records
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def raw_records
base_relation
.select(
<<-SQL
users.*,
Function formatTimestampsAsBubbleChartData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatTimestampsAsBubbleChartData (timestamps) {
const bubbleDataAsObject = {}
for (const timestamp of timestamps) {
const contactCreationTime = new Date(timestamp * 1000)
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 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)
if number.nil? || number.empty?
return true, nil
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"
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)
Function initializeMenuHighlight
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
initializeMenuHighlight () {
const linkHash = this.anchorLinkMap()
const observer = new window.IntersectionObserver(entries => {
entries.forEach(entry => {
- 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 set_active_banner
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_active_banner
return nil unless request.format.html?
return nil unless current_organization
@active_banner = current_organization.banners.active.first
- 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"
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"