belgattitude/nextjs-monorepo-example

View on GitHub

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;
Severity: Major
Found in apps/nextjs-app/src/layouts/admin/AdminSidebar.tsx - About 4 hrs to fix

    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 = () => {
    Severity: Minor
    Found in apps/nextjs-app/src/layouts/admin/AdminSidebar.tsx - About 4 hrs to fix

      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';
      
      
      Severity: Minor
      Found in packages/db-main-prisma/src/seeds/PoemSeeds.ts - About 2 hrs to fix

        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>,
        Severity: Minor
        Found in packages/core-lib/src/hooks/use-promise.ts - About 1 hr to fix

        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
        Severity: Minor
        Found in packages/ts-utils/src/asserts/asserts.ts - About 55 mins to fix

        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 ?? ''
            )
        Severity: Minor
        Found in packages/ts-utils/src/convert/string-convert.ts - About 25 mins to fix

        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') {
        Severity: Minor
        Found in packages/db-main-prisma/src/prisma-manager.ts - About 25 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language