pankod/refine

View on GitHub

Showing 812 of 823 total issues

Function serveWs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const serveWs = (
  server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>,
  onError: () => void,
) => {
  const ws = new WebSocket.Server({ server }).on("error", (error: any) => {
Severity: Minor
Found in packages/devtools-server/src/serve-ws.ts - About 1 hr to fix

    Function useCustomConfigSortToSorters has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const useCustomConfigSortToSorters = (j: JSCodeshift, source: Collection) => {
      const useCustomHooks = source.find(j.CallExpression, {
        callee: {
          name: "useCustom",
        },
    Severity: Minor
    Found in packages/codemod/src/transformations/v4/fix-v4-deprecations.ts - About 1 hr to fix

      Function transform has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  transform: (content) => {
                    let newContent = content;
                    const imports = getImports(content);
      
                    imports.map((importItem) => {
      Severity: Minor
      Found in packages/antd/refine.config.js - About 1 hr to fix

        Function basicInputFields has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const basicInputFields = (field: InferField) => {
            if (
              field.type === "text" ||
              field.type === "url" ||
              field.type === "email" ||
        Severity: Minor
        Found in packages/inferencer/src/inferencers/antd/create.tsx - About 1 hr to fix

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

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

            Function createResourcePathWithAction has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const createResourcePathWithAction = (
              resource: ResourceProps,
              action: Action,
            ) => {
              const { name, list, create, show, edit } = resource;
            Severity: Minor
            Found in packages/react-router-v6/src/create-resource-routes.tsx - About 1 hr to fix

              Function paginationProperties has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    (prop) => {
                      const property = (
                        (hasRefineCoreProps as ObjectProperty).value as ObjectExpression
                      ).properties.find((p: Property) => (p.key as Identifier).name === prop);
              
              
              Severity: Minor
              Found in packages/codemod/src/transformations/v4/fix-v4-deprecations.ts - About 1 hr to fix

                Function imageFields has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const imageFields = (field: InferField) => {
                    if (field.type === "image") {
                      imports.push(["ImageField", "@refinedev/antd"]);
                      if (field.multiple) {
                        const val = accessor("item", undefined, field.accessor);
                Severity: Minor
                Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 hr to fix

                  Function numberFields has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const numberFields = (field: InferField) => {
                      if (field.type === "number") {
                        imports.push(["NumberField", "@refinedev/antd"]);
                        if (field.multiple) {
                          const val = accessor("item", undefined, field.accessor);
                  Severity: Minor
                  Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 hr to fix

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

                      const dateFields = (field: InferField) => {
                        if (field.type === "date") {
                          imports.push(["DateField", "@refinedev/antd"]);
                          if (field.multiple) {
                            const val = accessor("item", undefined, field.accessor);
                    Severity: Minor
                    Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 hr to fix

                      Function imageFields has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const imageFields = (field: InferField) => {
                          if (field.type === "image") {
                            imports.push(["Image", "@chakra-ui/react"]);
                            if (field.multiple) {
                              const val = accessor("item", undefined, field.accessor);
                      Severity: Minor
                      Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 1 hr to fix

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

                          const dateFields = (field: InferField) => {
                            if (field.type === "date") {
                              imports.push(["DateField", "@refinedev/chakra-ui"]);
                              if (field.multiple) {
                                const val = accessor("item", undefined, field.accessor);
                        Severity: Minor
                        Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 1 hr to fix

                          Function compile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const compile = (filePath: string, params: any): string => {
                            const content = readFileSync(filePath);
                          
                            Handlebars.registerHelper("ifIn", (elem, list, options) => {
                              if (elem.includes(list)) {
                          Severity: Minor
                          Found in packages/cli/src/utils/compile/index.ts - About 1 hr to fix

                            Function useButtonCanAccess has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const useButtonCanAccess = (
                              props: ButtonCanAccessProps,
                            ): ButtonCanAccessValues => {
                              const translate = useTranslate();
                              const accessControlContext = React.useContext(AccessControlContext);
                            Severity: Minor
                            Found in packages/core/src/hooks/button/button-can-access/index.tsx - About 1 hr to fix

                              Function transformRefineOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const transformRefineOptions = (
                                j: JSCodeshift,
                                root: Collection<any>,
                                projectId: string,
                              ) => {
                              Severity: Minor
                              Found in packages/devtools-server/src/project-id/transform.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 RefineRoutes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const RefineRoutes = ({ children }: RefineRoutesProps) => {
                                const { resource, action } = useResource();
                                const { pathname } = useLocation();
                              
                                const resourceAction = resource && action ? resource[action] : undefined;
                              Severity: Minor
                              Found in packages/remix-router/src/refine-routes.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 RefineRoutes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const RefineRoutes = ({ children }: RefineRoutesProps) => {
                                const { resource, action } = useResource();
                                const { asPath: pathname, isReady } = useRouter();
                              
                                if (!isReady) {
                              Severity: Minor
                              Found in packages/nextjs-router/src/pages/refine-routes.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 RefineRoutes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const RefineRoutes = ({ children }: RefineRoutesProps) => {
                                const { resource, action } = useResource();
                                const pathname = usePathname();
                              
                                const resourceAction = resource && action ? resource[action] : undefined;
                              Severity: Minor
                              Found in packages/nextjs-router/src/app/refine-routes.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 updateRefineImports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function updateRefineImports(j: JSCodeshift, root: Collection<any>) {
                                const refineCoreImports = root.find(j.ImportDeclaration, {
                                  source: {
                                    value: "@pankod/refine-core",
                                  },
                              Severity: Minor
                              Found in packages/codemod/src/transformations/refine2-to-refine3.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 ResizablePane has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const ResizablePane = ({ placement, visible, children }: Props) => {
                                const [hover, setHover] = React.useState(false);
                                const [resizing, setResizing] = React.useState<
                                  "lx" | "rx" | "ty" | "by" | null
                                >(null);
                              Severity: Minor
                              Found in packages/devtools/src/components/resizable-pane.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

                              Severity
                              Category
                              Status
                              Source
                              Language