pankod/refine

View on GitHub

Showing 580 of 800 total issues

Function getWantedWithPreferredWildcard has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getWantedWithPreferredWildcard = (
  packageName: RefinePackageInstalledVersionData["name"],
  versionWanted: RefinePackageInstalledVersionData["wanted"],
): string => {
  const dependencies = getDependenciesWithVersion();
Severity: Minor
Found in packages/cli/src/commands/check-updates/index.tsx - About 1 hr to fix

    Function CodeViewerComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      ({ code: rawCode, loading }) => {
        const code = React.useMemo(() => {
          return prettierFormat(rawCode ?? "");
        }, [rawCode]);
    
    
    Severity: Minor
    Found in packages/inferencer/src/inferencers/antd/code-viewer.tsx - 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 usePagination has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const usePagination = (
      props: UsePaginationProps,
    ): {
      current: number;
      prev?: number;
    Severity: Minor
    Found in packages/chakra-ui/src/hooks/usePagination/index.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 relationToFieldable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const relationToFieldable: FieldTransformer = (
      fields,
      resources,
      resource,
      record,
    Severity: Minor
    Found in packages/inferencer/src/field-transformers/relation-to-fieldable.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 deepHasKey has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const deepHasKey = (obj: Record<string, any>, keys: string[]) => {
      // traverse all keys in the object
      for (const k in obj) {
        // if the key is in the object, return true
        if (keys.includes(k)) {
    Severity: Minor
    Found in packages/inferencer/src/utilities/deep-has-key/index.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 CodeViewerComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      ({ code: rawCode, loading }) => {
        const code = React.useMemo(() => {
          return prettierFormat(rawCode ?? "");
        }, [rawCode]);
    
    
    Severity: Minor
    Found in packages/inferencer/src/inferencers/mantine/code-viewer.tsx - 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 CodeViewerComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      ({ code: rawCode, loading }) => {
        const code = React.useMemo(() => {
          return prettierFormat(rawCode ?? "");
        }, [rawCode]);
    
    
    Severity: Minor
    Found in packages/inferencer/src/inferencers/headless/code-viewer.tsx - 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 CodeViewerComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      ({ code: rawCode, loading }) => {
        const code = React.useMemo(() => {
          return prettierFormat(rawCode ?? "");
        }, [rawCode]);
    
    
    Severity: Minor
    Found in packages/inferencer/src/inferencers/mui/code-viewer.tsx - 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 CodeViewerComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      ({ code: rawCode, loading }) => {
        const code = React.useMemo(() => {
          return prettierFormat(rawCode ?? "");
        }, [rawCode]);
    
    
    Severity: Minor
    Found in packages/inferencer/src/inferencers/chakra-ui/code-viewer.tsx - 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 gitInit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export function gitInit(root: string, message: string) {
      let didInit = false;
    
      try {
        execa.commandSync("git --version", { stdio: "ignore", cwd: root });
    Severity: Minor
    Found in packages/create-refine-app/src/example/git-init.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 createTreeView has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const createTreeView = (
      resources: IResourceItem[] | IMenuItem[],
    ): ITreeMenu[] | ITreeMenu[] => {
      const tree = [];
      const resourcesRouteObject: { [key: string]: any } = {};

    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 generateFilter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const generateFilter = (filters?: CrudFilters) => {
      const queryFilters: { [key: string]: any } = {};
    
      if (filters) {
        filters.map((filter) => {
    Severity: Minor
    Found in packages/graphql/src/utils/generateFilter.ts - About 1 hr to fix

      Function getMetaProps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getMetaProps = (
        identifier?: string,
        meta?: InferencerComponentProps["meta"],
        actions?: Action[],
      ) => {
      Severity: Minor
      Found in packages/inferencer/src/utilities/get-meta-props/index.ts - About 1 hr to fix

        Function addColumnsToUseDataGrid has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const addColumnsToUseDataGrid = (j: JSCodeshift, root: Collection<any>) => {
          const dataGridElement = root.find(j.JSXElement, {
            openingElement: {
              name: {
                name: "DataGrid",
        Severity: Minor
        Found in packages/codemod/src/transformations/use-data-grid-columns.ts - About 1 hr to fix

          Function booleanFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const booleanFields = (field: InferField) => {
              if (field.type === "boolean") {
                imports.push(["Checkbox", "antd"]);
          
                if (field.multiple) {
          Severity: Minor
          Found in packages/inferencer/src/inferencers/antd/create.tsx - About 1 hr to fix

            Function dateFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const dateFields = (field: InferField) => {
                if (field.type === "date") {
                  imports.push(["DatePicker", "antd"], ["dayjs", "dayjs", true]);
            
                  if (field.multiple) {
            Severity: Minor
            Found in packages/inferencer/src/inferencers/antd/create.tsx - About 1 hr to fix

              Function richtextFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const richtextFields = (field: InferField) => {
                  if (field?.type === "richtext") {
                    imports.push(["MarkdownField", "@refinedev/antd"]);
              
                    const dataIndex =
              Severity: Minor
              Found in packages/inferencer/src/inferencers/antd/list.tsx - About 1 hr to fix

                Function createResourceRoutes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const createResourceRoutes = (resources: ResourceProps[]) => {
                  const routes = resources.flatMap((resource) => {
                    const actions: {
                      action: Action;
                      element: React.ComponentType<any>;
                Severity: Minor
                Found in packages/react-router-v6/src/create-resource-routes.tsx - About 1 hr to fix

                  Function mapOperator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const mapOperator = (operator: CrudOperators) => {
                    switch (operator) {
                      case "ne":
                        return "neq";
                      case "nin":
                  Severity: Minor
                  Found in packages/supabase/src/utils/mapOperator.ts - About 1 hr to fix

                    Function handleMouseMove has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        const handleMouseMove = (e: MouseEvent) => {
                          if (resizing?.[1] === "x") {
                            const diff = e.clientX - (resizePosition?.x ?? e.clientX);
                            const newWidth =
                              panelSize.width + (resizing === "lx" ? -diff : diff) * 2;
                    Severity: Minor
                    Found in packages/devtools/src/components/resizable-pane.tsx - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language