Showing 45 of 100 total issues
File notifier.test.js
has 743 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-env jest */
import { escape } from 'lodash'
require('jest')
const { Notifier, Notification } = require('../src/notifier.js')
File dashboard.js
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
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
File validated_form.test.js
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-env jest */
require('jest')
const { Notifier } = require('../src/notifier.js')
const { NonDrivingContactMediumWarning } = require('../src/validated_form.js')
Class ApplicationPolicy
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationPolicy
class Scope
attr_reader :user, :scope
def initialize(user, scope)
Class CasaCaseDecorator
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CasaCaseDecorator < Draper::Decorator
include ActionView::Helpers::DateHelper
delegate_all
Class CaseContactDecorator
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CaseContactDecorator < Draper::Decorator
delegate_all
NOTES_CHARACTER_LIMIT = 100
Class CaseContact
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CaseContact < ApplicationRecord
include ByOrganizationScope
acts_as_paranoid
attr_accessor :duration_hours
Method initialize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
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
Open
function createChart (chartElement, dataset) {
const ctx = chartElement.getContext('2d')
return new Chart(ctx, {
type: 'bubble',
Function addAndCreate
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addAndCreate (e) {
this.add(e)
const items = this.element.querySelectorAll(this.wrapperSelectorValue)
const addedItem = items[items.length - 1]
// childIndex will be 0,1,... for items at page load, timestamps for items added to form.
Method save
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
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 destroyAndRemove
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
destroyAndRemove (e) {
const wrapper = e.target.closest(this.wrapperSelectorValue)
const recordId = this.getRecordId(wrapper)
if (wrapper.dataset.newRecord === 'false' && (recordId.length > 0)) {
fetch(`${this.routeValue}/${recordId}`, {
Method initialize
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(form:, hour_value:, minute_value:)
@form = form
if hour_value.is_a?(String)
begin
Function handleGenerateReport
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function handleGenerateReport (e) {
e.preventDefault()
const formData = Object.fromEntries(new FormData(e.currentTarget.form))
Function createMultiSelectWithOptionGroups
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createMultiSelectWithOptionGroups () {
const optionTemplate = this.optionTarget.innerHTML
const itemTemplate = this.itemTarget.innerHTML
const placeholder = `Select or search ${this.placeholderTermValue}`
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function submitForm
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
submitForm () {
fetch(this.formTarget.action, {
method: 'POST',
headers: { Accept: 'application/json' },
body: new FormData(this.formTarget)