Showing 10 of 28 total issues
File useObserver.spec.tsx
has 570 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable max-classes-per-file,react/button-has-type,no-plusplus */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import * as React from 'react'
import {render, act} from '@testing-library/react'
import useObserver from './useObserver'
File pureObserver.spec.ts
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable @typescript-eslint/ban-ts-ignore */
import * as td from 'testdouble'
import {pureObserver} from './useObserver'
test('it reacts to a change', () => {
Function attachProxyToField
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
function attachProxyToField(
object,
fieldName,
originalField,
callback,
- 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 attachProxyToField
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function attachProxyToField(
object,
fieldName,
originalField,
callback,
File useObserver.ts
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {useCallback, useEffect, useRef, useState} from 'react'
import {generateId} from './helpers/generateId'
class EventEmitter {
callbacks = {}
Function attachProxyToArray
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function attachProxyToArray(object, fieldName, callback, id): void {
object[fieldName].forEach((element, index) => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
recursivelyAttachProxy(element, index, object[fieldName], id, callback)
})
Function attachProxyToArray
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function attachProxyToArray(object, fieldName, callback, id): void {
object[fieldName].forEach((element, index) => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
recursivelyAttachProxy(element, index, object[fieldName], id, callback)
})
- 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 FileTree
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const FileTree: React.FC<IFileTree> = (props: Props) => {
const {fileTree} = props
useObserver(fileTree)
function loadFiles(): void {
Function recursivelyAttachProxy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
originalField,
fieldName,
object,
id,
callback: Function
Function attachProxyToField
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
object,
fieldName,
originalField,
callback,
id