Showing 7 of 9 total issues
Function AdminSidebar
has 397 lines of code (exceeds 300 allowed). Consider refactoring. Open
export const AdminSidebar: FC = () => {
// @todo better to use middleware or https://next-auth.js.org/getting-started/client#custom-client-session-handling
// const { data: session, status } = useSession();
const { data: session } = useSession();
const user = session?.user;
File AdminSidebar.tsx
has 402 lines of code (exceeds 300 allowed). Consider refactoring. Open
import { useSession } from 'next-auth/react';
import type { FC } from 'react';
import { TextAvatar } from '@/components/avatar/TextAvatar';
export const AdminSidebar: FC = () => {
File PoemSeeds.ts
has 312 lines of code (exceeds 300 allowed). Consider refactoring. Open
import keywordExtractor from 'keyword-extractor';
import { slugify } from 'transliteration';
import type { PrismaDbMain as Prisma } from '../';
import { AbstractSeed } from '../lib/AbstractSeed';
Function usePromise
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function usePromise<
TResult,
TVariables extends Record<string, unknown> = Partial<Record<string, unknown>>,
>(
promise: AsyncFn<TResult, TVariables>,
- 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 assertIncludes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function assertIncludes<T extends string[]>(
v: string | undefined,
stringArray: T,
msgOrErrorFactory?: MsgOrErrorFactory,
caseInsensitive?: boolean
- 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 stringToFloat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function stringToFloat(value: unknown): number | null {
if (
!isParsableNumeric(
typeof value === 'number' ? value.toString(10) : value ?? ''
)
- 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 getDevSafeInstance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static getDevSafeInstance(
instanceKey: string,
prismaClientFactory: () => PrismaClient
): PrismaClient {
if (process.env.NODE_ENV === 'production') {
- 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"