Showing 60 of 126 total issues
Function handleCircular
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
export function handleCircular(
target: Record<string, unknown>,
source: Record<string, unknown>,
prependKey: Path,
options: MergeQueryOptions,
- 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
File setData.ts
has 520 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _get from "lodash/get.js";
import _set from "lodash/set.js";
import _has from "lodash/has.js";
import { Forbidden } from "@feathersjs/errors";
Function handleCircular
has 181 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function handleCircular(
target: Record<string, unknown>,
source: Record<string, unknown>,
prependKey: Path,
options: MergeQueryOptions,
File utils.ts
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Forbidden } from "@feathersjs/errors";
import _get from "lodash/get.js";
import _has from "lodash/has.js";
import _set from "lodash/set.js";
Function mergeArrays
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function mergeArrays<T>(
targetArr: T[] | undefined,
sourceArr: T[] | undefined,
handle: Handle,
prependKey?: Path,
- 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
File getItemsIsArray.ts
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { HookContext } from "@feathersjs/feathers";
export type GetItemsIsArrayFrom = "data" | "result" | "automatic";
export type GetItemsIsArrayOptions = {
File setResultEmpty.ts
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { HookContext } from "@feathersjs/feathers";
import { isMulti } from "./isMulti";
import { isPaginated } from "./isPaginated";
/**
Function flattenQuery
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function flattenQuery(q: Query) {
if (Array.isArray(q)) {
return q.map(flattenQuery);
}
Function getItemsIsArray
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const getItemsIsArray = <T = any, H extends HookContext = HookContext>(
context: H,
options?: GetItemsIsArrayOptions,
): GetItemsIsArrayResult<T> => {
const { from = "automatic" } = options || {};
- 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 setData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function setData<H extends HookContext = HookContext>(
from: PropertyPath,
to: PropertyPath,
_options?: HookSetDataOptions,
) {
Function mergeArrays
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mergeArrays<T>(
targetArr: T[] | undefined,
sourceArr: T[] | undefined,
handle: Handle,
prependKey?: Path,
Function setQueryKeySafely
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const setQueryKeySafely = (
params: Params,
key: string,
value: any,
operator = "$eq",
- 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 defineParamsFromClient
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function defineParamsFromClient(keyToHide: string) {
return function paramsFromClient(
...whitelist: string[]
): (context: HookContext) => HookContext {
return (context: HookContext): HookContext => {
Function setQueryKeySafely
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setQueryKeySafely = (
params: Params,
key: string,
value: any,
operator = "$eq",
Function forEach
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const forEach = <H extends HookContext = HookContext, T = any, R = any>(
actionPerItem: ActionPerItem<T, H, R>,
options?: HookForEachOptions<T, H, R>,
): ReturnAsyncHook<H> => {
const { wait = "parallel", items: from = "automatic" } = options || {};
Function step
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function step(object: Query, options?: StepOptions) {
const { prev = [], result = res } = options ?? {};
Object.keys(object).forEach((key) => {
const value = object[key];
Function defineParamsForServer
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function defineParamsForServer(keyToHide: string) {
return function paramsForServer(...whitelist: string[]) {
return <H extends HookContext>(context: H) => {
// clone params on demand
let clonedParams;
Function paramsFromClient
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function paramsFromClient(
...whitelist: string[]
): (context: HookContext) => HookContext {
return (context: HookContext): HookContext => {
if (
Function optimizeBatchPatch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function optimizeBatchPatch<
T extends Record<string, any>,
IdKey extends KeyOf<T>,
P extends Params,
R extends Omit<T, IdKey> = Omit<T, IdKey>,
Function paramsForServer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function paramsForServer(...whitelist: string[]) {
return <H extends HookContext>(context: H) => {
// clone params on demand
let clonedParams;