pankod/refine

View on GitHub

Showing 756 of 987 total issues

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

        const renderTreeView = (tree: ITreeMenu[], selectedKey?: string) => {
          return tree.map((item: ITreeMenu) => {
            const {
              icon,
              label,
      Severity: Major
      Found in packages/antd/src/components/themedLayoutV2/sider/index.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 renderTreeView has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const renderTreeView = (tree: ITreeMenu[], selectedKey?: string) => {
                  return tree.map((item: ITreeMenu) => {
                    const {
                      icon,
                      label,
              Severity: Major
              Found in packages/antd/src/components/layout/sider/index.tsx - About 2 hrs to fix

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

                export const RegisterPage: React.FC<RegisterProps> = ({
                  loginLink,
                  contentProps,
                  wrapperProps,
                  renderContent,

                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 a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                export const LoginPage: React.FC<LoginProps> = ({
                  providers,
                  registerLink,
                  forgotPasswordLink,
                  rememberMe,
                Severity: Minor
                Found in packages/mantine/src/components/pages/auth/components/login/index.tsx - 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 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/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"]);
                    
                    
                    Severity: Major
                    Found in packages/inferencer/src/inferencers/mui/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

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

                              const clearedFields = React.useMemo(() => {
                                const cleanFields: InferField[] = [];
                          
                                results.forEach((f, idx, arr) => {
                                  if (f.resource) {
                          Severity: Major
                          Found in packages/inferencer/src/create-inferencer/index.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 replaceImports has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const replaceImports = (content: string): string => {
                                  const matches = content.matchAll(packageRegex);
                                
                                  const imports = new Set();
                                
                                
                                Severity: Major
                                Found in packages/live-previews/src/utils/replace-imports.ts - About 2 hrs to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                    if (syncWithLocation) {
                                      defaultCurrent =
                                        parsedParams?.params?.current || parsedCurrent || prefferedCurrent || 1;
                                      defaultPageSize =
                                        parsedParams?.params?.pageSize ||
                                  Severity: Critical
                                  Found in packages/core/src/hooks/useTable/index.ts - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language