Showing 40 of 93 total issues
File notifier.test.js
has 743 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-env jest */
import { escape } from 'lodash'
require('jest')
const { Notifier, Notification } = require('../src/notifier.js')
File validated_form.test.js
has 545 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-env jest */
require('jest')
const { Notifier } = require('../src/notifier.js')
const { NonDrivingContactMediumWarning, RangedDatePicker } = require('../src/validated_form.js')
File dashboard.js
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global alert */
/* global $ */
const { Notifier } = require('./notifier')
let pageNotifier
File patch_notes.js
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
const { Notifier } = require('../notifier')
const TypeChecker = require('../type_checker')
const patchNotePath = window.location.pathname
const patchNoteFormBeforeEditData = {}
const patchNoteFunctions = {} // A hack to be able to alphabetize functions
Class ApplicationPolicy
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationPolicy
class Scope
attr_reader :user, :scope
def initialize(user, scope)
Class CaseContact
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class CaseContact < ApplicationRecord
include ByOrganizationScope
acts_as_paranoid
attr_accessor :duration_hours
Class CasaCaseDecorator
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class CasaCaseDecorator < Draper::Decorator
include ActionView::Helpers::DateHelper
delegate_all
Class CaseContactDecorator
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CaseContactDecorator < Draper::Decorator
delegate_all
NOTES_CHARACTER_LIMIT = 100
Method initialize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def initialize(form:, hour_value:, minute_value:)
@form = form
if hour_value.is_a?(String)
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
Function createChart
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createChart (chartElement, dataset) {
const ctx = chartElement.getContext('2d')
return new Chart(ctx, {
type: 'bubble',
Method save
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save
authorize CasaCase, :save_emancipation?
params.permit(:casa_case_id, :check_item_action)
begin
Function onSavePatchNote
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
patchNoteFunctions.onSavePatchNote = function () {
const patchNoteForm = $(this).parents('.card-body')
const patchNoteFormInputs = patchNoteFunctions.getPatchNoteFormInputs(patchNoteForm)
if ($(this).parent().siblings('textarea').val() === '') {
Method populate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.populate
CaseContact.find_each do |case_contact|
# Get rid of drafts
unless case_contact.casa_case
case_contact.destroy
- 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 handleGenerateReport
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleGenerateReport (e) {
e.preventDefault()
const formData = Object.fromEntries(new FormData(e.currentTarget.form))
Method initialize
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(form:, hour_value:, minute_value:)
@form = form
if hour_value.is_a?(String)
begin
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: (data, type, row, meta) => {
const noContactVolunteers = Number(row.no_attempt_for_two_weeks)
const transitionAgedCaseVolunteers = Number(row.transitions_volunteers)
const activeContactVolunteers = Number(row.volunteer_assignments) - noContactVolunteers
const activeContactElement = activeContactVolunteers
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 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)
Method raw_records
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def raw_records
base_relation
.select(
<<-SQL
users.*,