pankod/refine

View on GitHub

Showing 750 of 983 total issues

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

        export const useImport = <
          TItem = any,
          TData extends BaseRecord = BaseRecord,
          TError extends HttpError = HttpError,
          TVariables = any,
        Severity: Minor
        Found in packages/antd/src/hooks/import/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 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 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 ForgotPasswordPage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const ForgotPasswordPage: React.FC<ResetPassworProps> = ({
          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 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

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

        export const MonitorDetails = ({ activity }: { activity?: Activity }) => {
          return (
            <div className={clsx("re-h-full", "re-text-gray-300", "re-relative")}>
              <div
                className={clsx(
        Severity: Minor
        Found in packages/devtools-ui/src/components/monitor-details.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 normalizeData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const normalizeData = (data: any): any => {
          if (Array.isArray(data)) {
            return data.map((item) => normalizeData(item));
          }
        
        
        Severity: Minor
        Found in packages/strapi-v4/src/utils/normalizeData.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/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 useDataProvider has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useDataProvider = (): ((
          /**
           * The name of the `data provider` you want to access
           */
          dataProviderName?: string,
        Severity: Minor
        Found in packages/core/src/hooks/data/useDataProvider.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 useResourceParams has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export function useResourceParams(props?: Props): ResourceParams {
          const { select, identifier: inferredIdentifier } = useResource();
          const resourceToCheck = props?.resource ?? inferredIdentifier;
          const { identifier = undefined, resource = undefined } = resourceToCheck
            ? select(resourceToCheck, true)
        Severity: Minor
        Found in packages/core/src/hooks/use-resource-params/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 LegacyAuthContextProvider has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        > = ({ children, isProvided, ...authOperations }) => {
          const { replace } = useNavigation();
        
          const loginFunc = async (params: any) => {
            try {
        Severity: Minor
        Found in packages/core/src/contexts/auth/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 useOne has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useOne = <
          TQueryFnData extends BaseRecord = BaseRecord,
          TError extends HttpError = HttpError,
          TData extends BaseRecord = TQueryFnData,
        >({
        Severity: Minor
        Found in packages/core/src/hooks/data/useOne.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 useLog has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useLog = <
          TLogData,
          TLogRenameData extends LogRenameData = LogRenameData,
        >({
          logMutationOptions,
        Severity: Minor
        Found in packages/core/src/hooks/auditLog/useLog/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 emailFields has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function useQuerySubscription has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              : (queryClient: QueryClient) => {
                  const { ws } = useContext(DevToolsContext);
                  const queryCacheSubscription = React.useRef<() => void>();
                  const mutationCacheSubscription = React.useRef<() => void>();
          
          
          Severity: Minor
          Found in packages/devtools-internal/src/use-query-subscription.tsx - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language