pankod/refine

View on GitHub

Showing 756 of 987 total issues

Function ConfigErrorPage has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ConfigErrorPage = () => {
  return (
    <div
      style={{
        position: "fixed",
Severity: Major
Found in packages/core/src/components/pages/config-error/index.tsx - About 4 hrs to fix

    Function renderRelationFields has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const renderRelationFields = (field: InferField) => {
        if (field.relation && field.resource) {
          const variableName = `${getVariableName(field.key, "Data")}?.data`;
          const variableIsLoading = getVariableName(field.key, "IsLoading");
    
    
    Severity: Major
    Found in packages/inferencer/src/inferencers/mui/list.tsx - About 4 hrs to fix

      Function renderRelationFields has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const renderRelationFields = (field: InferField) => {
          if (field.relation && field.resource) {
            const variableName = getVariableName(field.key, "Data");
            const variableIsLoading = getVariableName(field.key, "IsLoading");
      
      
      Severity: Major
      Found in packages/inferencer/src/inferencers/antd/show.tsx - About 4 hrs to fix

        Function LoginForm has 111 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const LoginForm = (props: { className?: string }) => {
          const { ws } = React.useContext(DevToolsContext);
          const [searchParams] = useSearchParams();
          const [flowData, setFlowData] = React.useState<LoginFlow | null>(null);
        
        
        Severity: Major
        Found in packages/devtools-ui/src/pages/login.tsx - About 4 hrs to fix

          Function useSimpleList has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          export const useSimpleList = <
            TQueryFnData extends BaseRecord = BaseRecord,
            TError extends HttpError = HttpError,
            TSearchVariables = unknown,
            TData extends BaseRecord = TQueryFnData,
          Severity: Minor
          Found in packages/antd/src/hooks/list/useSimpleList/useSimpleList.ts - About 4 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 useModalForm has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          export const useModalForm = <
            TQueryFnData extends BaseRecord = BaseRecord,
            TError extends HttpError = HttpError,
            TVariables extends FieldValues = FieldValues,
            TContext extends object = {},
          Severity: Minor
          Found in packages/react-hook-form/src/useModalForm/index.ts - About 4 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 renderRelationFields has 108 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const renderRelationFields = (field: InferField) => {
              if (field.relation && field.resource) {
                const variableName = `${getVariableName(field.key, "Data")}?.data`;
          
                if (Array.isArray(field.accessor)) {
          Severity: Major
          Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx - About 4 hrs to fix

            Function reorderImports has 108 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const reorderImports = (content: string): string => {
              let newContent = content;
              // imports can have comments before them, we need to preserve those comments and import statements.
              // so we need to filter out the imports with comments before.
              const allImports = getImports(content);
            Severity: Major
            Found in packages/cli/src/utils/swizzle/import.ts - About 4 hrs to fix

              Function renderRelationFields has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const renderRelationFields = (field: InferField) => {
                  if (field.relation && field.resource) {
                    const variableName = `${getVariableName(field.key, "Data")}?.data`;
              
                    if (Array.isArray(field.accessor)) {
              Severity: Major
              Found in packages/inferencer/src/inferencers/mantine/list.tsx - About 4 hrs to fix

                Function List has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const List: React.FC<ListProps> = (props) => {
                  const {
                    canCreate,
                    children,
                    createButtonProps: createButtonPropsFromProps,
                Severity: Major
                Found in packages/chakra-ui/src/components/crud/list/index.tsx - About 4 hrs to fix

                  Function useModalForm has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const useModalForm = <
                    TQueryFnData extends BaseRecord = BaseRecord,
                    TError extends HttpError = HttpError,
                    TVariables = {},
                    TData extends BaseRecord = TQueryFnData,
                  Severity: Minor
                  Found in packages/antd/src/hooks/form/useModalForm/useModalForm.ts - About 4 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 Create has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const Create: React.FC<CreateProps> = (props) => {
                    const {
                      children,
                      saveButtonProps: saveButtonPropsFromProps,
                      isLoading,
                  Severity: Minor
                  Found in packages/chakra-ui/src/components/crud/create/index.tsx - About 4 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 checkPackage has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const checkPackage = (code = "") => {
                    const set = new Set<string>();
                  
                    const hasAntd =
                      code.includes("@refinedev/antd") ||
                  Severity: Minor
                  Found in packages/live-previews/src/utils/check-package.ts - About 4 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 useTable has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function useTable<
                    TQueryFnData extends BaseRecord = BaseRecord,
                    TError extends HttpError = HttpError,
                    TData extends BaseRecord = TQueryFnData,
                  >({
                  Severity: Minor
                  Found in packages/core/src/hooks/useTable/index.ts - About 4 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 useForgotPassword has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function useForgotPassword<TVariables = {}>({
                    v3LegacyAuthProviderCompatible,
                    mutationOptions,
                  }:
                    | UseForgotPasswordProps<TVariables>
                  Severity: Minor
                  Found in packages/core/src/hooks/auth/useForgotPassword/index.ts - About 4 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 LoginPage has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const LoginPage: React.FC<LoginPageProps> = () => {
                    const [form] = Form.useForm<ILoginForm>();
                    const translate = useTranslate();
                  
                    const authProvider = useActiveAuthProvider();
                  Severity: Major
                  Found in packages/antd/src/components/pages/login/index.tsx - About 4 hrs to fix

                    Function renderCrud has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        const renderCrud = () => {
                          switch (action) {
                            case undefined:
                              return (
                                <CanAccess
                    Severity: Major
                    Found in packages/react-router-v6/src/legacy/routeProvider.tsx - About 4 hrs to fix

                      Function useModalForm has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const useModalForm = <
                        TQueryFnData extends BaseRecord = BaseRecord,
                        TError extends HttpError = HttpError,
                        TVariables = Record<string, unknown>,
                        TTransformed = TVariables,
                      Severity: Minor
                      Found in packages/mantine/src/hooks/form/useModalForm/index.ts - About 4 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 28 (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/antd/src/hooks/form/useForm.ts - About 4 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 useDrawerForm has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const useDrawerForm = <
                        TQueryFnData extends BaseRecord = BaseRecord,
                        TError extends HttpError = HttpError,
                        TVariables = {},
                        TData extends BaseRecord = TQueryFnData,
                      Severity: Minor
                      Found in packages/antd/src/hooks/form/useDrawerForm/useDrawerForm.ts - About 4 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