pankod/refine

View on GitHub

Showing 561 of 707 total issues

Function authProvider has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const authProvider = (API_URL: string): AuthProvider => {
  const axiosInstance = axios.create();

  axiosInstance.interceptors.response.use(
    (response) => {
Severity: Major
Found in packages/medusa/src/authProvider/index.ts - About 2 hrs to fix

    Function ReadyPage has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const ReadyPage: React.FC<RefineReadyPageProps> = () => {
      return (
        <Box
          p="4"
          display="flex"
    Severity: Major
    Found in packages/chakra-ui/src/components/pages/ready/index.tsx - About 2 hrs to fix

      Function ErrorComponent has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const ErrorComponent: React.FC<RefineErrorPageProps> = () => {
        const [errorMessage, setErrorMessage] = useState<string>();
        const translate = useTranslate();
        const { push } = useNavigation();
        const go = useGo();
      Severity: Major
      Found in packages/chakra-ui/src/components/pages/error/index.tsx - About 2 hrs to fix

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

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

          Function getVersionTable has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const getVersionTable = (
            packages: RefinePackageInstalledVersionData[] = [],
          ) => {
            const tableHead = Object.keys(packages?.[0] || {});
            if (!packages || !tableHead.length) return { table: "", width: 0 };
          Severity: Major
          Found in packages/cli/src/components/version-table/index.ts - About 2 hrs to fix

            Function basicToRelation has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            export const basicToRelation: FieldTransformer = (
              fields,
              resources,
              resource,
              record,
            Severity: Minor
            Found in packages/inferencer/src/field-transformers/basic-to-relation.ts - About 2 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 fixUseListHasPaginationToPaginationMode has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const fixUseListHasPaginationToPaginationMode = (
              j: JSCodeshift,
              source: Collection,
            ) => {
              const useListHooks = source.find(j.CallExpression, {
            Severity: Major
            Found in packages/codemod/src/transformations/v4/fix-v4-deprecations.ts - About 2 hrs to fix

              Function MockGoogleButton has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const MockGoogleButton = () => {
                const { mutate } = useLogin();
              
                return (
                  <button
              Severity: Major
              Found in packages/live-previews/src/scope/google.tsx - About 2 hrs to fix

                Function moveConfigProvider has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const moveConfigProvider = (j: JSCodeshift, root: Collection<any>) => {
                  const refineElement = root.find(j.JSXElement, {
                    openingElement: {
                      name: {
                        name: "Refine",
                Severity: Major
                Found in packages/codemod/src/transformations/refine2-to-refine3.ts - About 2 hrs to fix

                  Function booleanFields has 63 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: Major
                  Found in packages/inferencer/src/inferencers/mui/edit.tsx - About 2 hrs to fix

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

                      const booleanFields = (field: InferField) => {
                        if (field.type === "boolean") {
                          imports.push(["Checkbox", "@chakra-ui/react"]);
                    
                          if (field.multiple) {
                    Severity: Major
                    Found in packages/inferencer/src/inferencers/chakra-ui/edit.tsx - About 2 hrs to fix

                      Function generateFilter has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const generateFilter = (filter: CrudFilter, query: any) => {
                        switch (filter.operator) {
                          case "eq":
                            return query.eq(filter.field, filter.value);
                          case "ne":
                      Severity: Major
                      Found in packages/supabase/src/utils/generateFilter.ts - About 2 hrs to fix

                        Function operatorMapper has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const operatorMapper = (
                          operator: CrudOperators,
                          value: any,
                        ): { [key: string]: any } => {
                          if (operator === "contains") {
                        Severity: Major
                        Found in packages/nestjs-query/src/utils/index.ts - About 2 hrs to fix

                          Function run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const run = async (
                            example: string | boolean | undefined,
                            destination?: string,
                          ) => {
                            const pm = findPM();
                          Severity: Minor
                          Found in packages/create-refine-app/src/example/index.ts - About 2 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 assertFormShouldHaveResponseValues has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const assertFormShouldHaveResponseValues = (response: any, ui: UITypes) => {
                            const body = response?.body;
                          
                            // assert response values are equal to the form values
                            switch (ui) {
                          Severity: Major
                          Found in cypress/support/commands/resource.ts - About 2 hrs to fix

                            Function relationHooksCode has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                .map((field) => {
                                  if (field?.relation && !field.fieldable && field.resource) {
                                    if (field.multiple) {
                                      imports.push(["useMany", "@refinedev/core"]);
                                      let ids = accessor(recordName, field.key);
                            Severity: Major
                            Found in packages/inferencer/src/inferencers/headless/show.tsx - About 2 hrs to fix

                              Function relationHooksCode has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  .map((field) => {
                                    if (field?.relation && !field.fieldable && field.resource) {
                                      if (field.multiple) {
                                        imports.push(["useMany", "@refinedev/core"]);
                              
                              
                              Severity: Major
                              Found in packages/inferencer/src/inferencers/mantine/show.tsx - About 2 hrs to fix

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

                                  const basicInputFields = (field: InferField) => {
                                    if (
                                      field.type === "text" ||
                                      field.type === "url" ||
                                      field.type === "email" ||
                                Severity: Major
                                Found in packages/inferencer/src/inferencers/chakra-ui/create.tsx - About 2 hrs to fix

                                  Function relationHooksCode has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      .map((field) => {
                                        if (field?.relation && !field.fieldable && field.resource) {
                                          if (field.multiple) {
                                            imports.push(["useMany", "@refinedev/core"]);
                                            let ids = accessor(recordName, field.key);
                                  Severity: Major
                                  Found in packages/inferencer/src/inferencers/antd/show.tsx - About 2 hrs to fix

                                    Function relationHooksCode has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        .map((field) => {
                                          if (field?.relation && !field.fieldable && field.resource) {
                                            if (field.multiple) {
                                              imports.push(["useMany", "@refinedev/core"]);
                                              let ids = accessor(recordName, field.key);
                                    Severity: Major
                                    Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language