pankod/refine

View on GitHub

Showing 812 of 823 total issues

Function ProjectIdFixModal has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const ProjectIdFixModal = ({ visible, onClose, projectId }: Props) => {
  const [copied, setCopied] = React.useState(false);

  const onCopy = React.useCallback(() => {
    if (projectId) {
Severity: Minor
Found in packages/devtools-ui/src/components/project-id-fix-modal.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 getProjectType has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const getProjectType = (platform?: ProjectTypes): ProjectTypes => {
  if (platform) {
    return platform;
  }
  // read dependencies from package.json
Severity: Minor
Found in packages/cli/src/utils/project/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 useNavigationButton has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function useNavigationButton(
  props: NavigationButtonProps,
): NavigationButtonValues {
  const navigation = useNavigation();
  const routerType = useRouterType();
Severity: Minor
Found in packages/core/src/hooks/button/navigation-button/index.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 subscribe has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    subscribe({ callback, params, meta }) {
      const { resource, subscriptionType } = params ?? {};

      if (!meta || !subscriptionType || !resource) {
        throw new Error(
Severity: Minor
Found in packages/graphql/src/liveProvider/index.ts - About 1 hr to fix

    Function defaultLayout has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

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

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

            .map((field) => {
              if (field?.relation && !field.fieldable && field.resource) {
                imports.push(["useSelect", "@refinedev/core"]);
                let val = accessor(recordName, field.key, field.accessor, false);
        
        
        Severity: Minor
        Found in packages/inferencer/src/inferencers/chakra-ui/edit.tsx - About 1 hr to fix

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

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

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

                .map((field) => {
                  if (field?.relation && !field.fieldable && field.resource) {
                    imports.push(["useSelect", "@refinedev/core"]);
                    let val = accessor(recordName, field.key, field.accessor, false);
            
            
            Severity: Minor
            Found in packages/inferencer/src/inferencers/headless/edit.tsx - About 1 hr to fix

              Function urlFields has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const urlFields = (field: InferField) => {
                  if (field.type === "url") {
                    imports.push(
                      ["TagField", "@refinedev/antd"],
                      ["UrlField", "@refinedev/antd"],
              Severity: Minor
              Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 hr to fix

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

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

                  Function Login has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Login = () => {
                    return (
                      <div
                        className={clsx(
                          "re-min-h-screen re-w-full",
                  Severity: Minor
                  Found in packages/devtools-ui/src/pages/login.tsx - About 1 hr to fix

                    Function Onboarding has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const Onboarding = () => {
                      return (
                        <div
                          className={clsx(
                            "re-min-h-screen re-w-full",
                    Severity: Minor
                    Found in packages/devtools-ui/src/pages/onboarding.tsx - About 1 hr to fix

                      Function subscribe has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          subscribe({ callback, params, meta }) {
                            const { resource, subscriptionType } = params ?? {};
                      
                            if (!meta || !subscriptionType || !resource) {
                              throw new Error(
                      Severity: Minor
                      Found in packages/nestjs-query/src/liveProvider/index.ts - About 1 hr to fix

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

                                (prop) => {
                                  const property = (
                                    p.node.arguments[0] 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 booleanFields has 34 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: Minor
                          Found in packages/inferencer/src/inferencers/chakra-ui/create.tsx - About 1 hr to fix

                            Function textFields has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const textFields = (field: InferField) => {
                                if (field.type === "text") {
                                  imports.push(
                                    ["TagField", "@refinedev/antd"],
                                    ["TextField", "@refinedev/antd"],
                            Severity: Minor
                            Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 hr to fix

                              Function gitInit has 34 lines of code (exceeds 25 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

                                Function mergedImports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    ([importPath, importMatches]) => {
                                      // example: A
                                      const defaultImport = importMatches.find(
                                        (importMatch) => importMatch.defaultImport,
                                      );
                                Severity: Minor
                                Found in packages/cli/src/utils/swizzle/import.ts - About 1 hr to fix

                                  Function generateDefaultDocumentTitle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function generateDefaultDocumentTitle(
                                    translate: ReturnType<typeof useTranslate>,
                                    resource?: IResourceItem,
                                    action?: string,
                                    id?: string,
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language