pankod/refine

View on GitHub

Showing 580 of 800 total issues

Function renderer has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

export const renderer = ({
  resource,
  fields,
  meta,
  isCustomPage,
Severity: Minor
Found in packages/inferencer/src/inferencers/headless/edit.tsx - About 1 day 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 renderer has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

export const renderer = ({
  resource,
  fields,
  meta,
  isCustomPage,
Severity: Minor
Found in packages/inferencer/src/inferencers/mui/show.tsx - About 1 day 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 dataProvider has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

const dataProvider = (client: GraphQLClient): Required<DataProvider> => {
  return {
    getList: async ({ resource, pagination, sorters, filters, meta }) => {
      const operation = camelcase(resource);

Severity: Minor
Found in packages/nestjs-query/src/dataProvider/index.ts - About 1 day 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 dataProvider has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

const dataProvider = (client: GraphQLClient): Required<DataProvider> => {
  return {
    getList: async ({ resource, pagination, sorters, filters, meta }) => {
      const { current = 1, pageSize = 10, mode = "server" } = pagination ?? {};

Severity: Minor
Found in packages/graphql/src/dataProvider/index.ts - About 1 day 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 resolver has 206 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async (allFields: (InferField | false | null)[]) => {
      console.groupCollapsed(
        "@refinedev/inferencer is trying to detect relations",
      );
      const attempts: Array<ResourceInferenceAttempt> = [];
Severity: Major
Found in packages/inferencer/src/use-relation-fetch/index.ts - About 1 day to fix

    Function replaceImports has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

    export const replaceImports = (content: string): string => {
      const matches = content.matchAll(packageRegex);
    
      const imports = new Set();
    
    
    Severity: Minor
    Found in packages/live-previews/src/utils/replace-imports.ts - About 1 day 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 useNotificationProvider has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useNotificationProvider = (): NotificationProvider => {
      const activeNotifications: string[] = [];
    
      const isNotificationActive = (key?: string) => {
        return activeNotifications.includes(key as string);
    Severity: Minor
    Found in packages/mantine/src/providers/notificationProvider.tsx - About 7 hrs 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 dataProvider has 194 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const dataProvider = (
      supabaseClient: SupabaseClient<any, any, any>,
    ): Required<DataProvider> => {
      return {
        getList: async ({ resource, pagination, filters, sorters, meta }) => {
    Severity: Major
    Found in packages/supabase/src/dataProvider/index.ts - About 7 hrs to fix

      Function renderer has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

      export const renderer = ({
        resource,
        fields,
        meta,
        isCustomPage,
      Severity: Minor
      Found in packages/inferencer/src/inferencers/headless/create.tsx - About 7 hrs 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 objectInfer has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

      export const objectInfer: FieldInferencer = (
        key,
        value,
        record,
        infer,
      Severity: Minor
      Found in packages/inferencer/src/field-inferencers/object.ts - About 7 hrs 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 useForm has 186 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useForm = <
        TQueryFnData extends BaseRecord = BaseRecord,
        TError extends HttpError = HttpError,
        TVariables = {},
        TData extends BaseRecord = TQueryFnData,
      Severity: Major
      Found in packages/core/src/hooks/form/index.ts - About 7 hrs to fix

        Function renderer has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

        export const renderer = ({
          resource,
          fields,
          meta,
          isCustomPage,
        Severity: Minor
        Found in packages/inferencer/src/inferencers/chakra-ui/edit.tsx - About 7 hrs 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 useForm has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useForm = <
          TQueryFnData extends BaseRecord = BaseRecord,
          TError extends HttpError = HttpError,
          TVariables = {},
          TData extends BaseRecord = TQueryFnData,
        Severity: Minor
        Found in packages/core/src/hooks/form/index.ts - About 7 hrs 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 action has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const action = async (_options: OptionValues) => {
          inquirer.registerPrompt("autocomplete", inquirerAutoCompletePrompt);
        
          const installedPackages = await getInstalledRefinePackagesFromNodeModules();
        
        
        Severity: Major
        Found in packages/cli/src/commands/swizzle/index.tsx - About 7 hrs to fix

          Function promises has 175 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  const promises = allFields.map(async (field) => {
                    if (field && (field.relation || field.canRelation)) {
                      if (record) {
                        if (field.relationInfer) {
                          return field;
          Severity: Major
          Found in packages/inferencer/src/use-relation-fetch/index.ts - About 7 hrs to fix

            Function fixDeprecatedReactTableProps has 174 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const fixDeprecatedReactTableProps = (j: JSCodeshift, source: Collection) => {
              const refineReactTableImports = source.find(j.ImportDeclaration, {
                source: {
                  value: "@pankod/refine-react-table",
                },
            Severity: Major
            Found in packages/codemod/src/transformations/v4/fix-v4-deprecations.ts - About 6 hrs to fix

              Function Packages has 169 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const Packages = () => {
                const ref = React.useRef<FireworksHandlers>(null);
                const [packages, setPackages] = React.useState<PackageType[]>([]);
                const [visible, setVisible] = React.useState(false);
                const [outdatedPackages, setOutdatedPackages] = React.useState<string[]>([]);
              Severity: Major
              Found in packages/devtools-ui/src/components/packages.tsx - About 6 hrs to fix

                Function createInferencer has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                Open

                export const createInferencer: CreateInferencer = ({
                  type,
                  additionalScope = [],
                  customElements = [],
                  fieldTransformers = [],
                Severity: Minor
                Found in packages/inferencer/src/create-inferencer/index.tsx - About 6 hrs 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 run has 165 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const run = async (
                  example: string | boolean | undefined,
                  destination?: string,
                ) => {
                  const pm = findPM();
                Severity: Major
                Found in packages/create-refine-app/src/example/index.ts - About 6 hrs to fix

                  Function renderer has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const renderer = ({
                    resource,
                    fields,
                    meta,
                    isCustomPage,
                  Severity: Minor
                  Found in packages/inferencer/src/inferencers/chakra-ui/create.tsx - About 6 hrs 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