pankod/refine

View on GitHub

Showing 756 of 987 total issues

Function CodeViewerComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  ({ code: rawCode, loading }) => {
    const code = React.useMemo(() => {
      return prettierFormat(rawCode ?? "");
    }, [rawCode]);

Severity: Minor
Found in packages/inferencer/src/inferencers/headless/code-viewer.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 gitInit has a Cognitive Complexity of 10 (exceeds 5 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

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

const DataProvider = (
  apiUrl: string,
  httpClient: AxiosInstance = axiosInstance,
): Required<DataProviderType> => {
  return {
Severity: Minor
Found in packages/medusa/src/dataProvider/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 useStepsForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const useStepsForm = <
  TQueryFnData extends BaseRecord = BaseRecord,
  TError extends HttpError = HttpError,
  TVariables extends FieldValues = FieldValues,
  TContext extends object = {},
Severity: Minor
Found in packages/react-hook-form/src/useStepsForm/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 createTreeView has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const createTreeView = (
  resources: IResourceItem[] | IMenuItem[],
): ITreeMenu[] | ITreeMenu[] => {
  const tree = [];
  const resourcesRouteObject: { [key: string]: any } = {};

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

    onMutationError: (error, _variables, _context) => {
      if (disableServerSideValidation) {
        refineCoreProps?.onMutationError?.(error, _variables, _context);
        return;
      }
Severity: Minor
Found in packages/mantine/src/hooks/form/useForm/index.ts - About 1 hr to fix

    Function addColumnsToUseDataGrid has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const addColumnsToUseDataGrid = (j: JSCodeshift, root: Collection<any>) => {
      const dataGridElement = root.find(j.JSXElement, {
        openingElement: {
          name: {
            name: "DataGrid",
    Severity: Minor
    Found in packages/codemod/src/transformations/use-data-grid-columns.ts - About 1 hr to fix

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

      export const generateFilter = (filters?: CrudFilters) => {
        const queryFilters: { [key: string]: any } = {};
      
        if (filters) {
          filters.map((filter) => {
      Severity: Minor
      Found in packages/graphql/src/utils/generateFilter.ts - About 1 hr to fix

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

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

          Function getMetaProps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const getMetaProps = (
            identifier?: string,
            meta?: InferencerComponentProps["meta"],
            actions?: Action[],
          ) => {
          Severity: Minor
          Found in packages/inferencer/src/utilities/get-meta-props/index.ts - About 1 hr to fix

            Function richtextFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const richtextFields = (field: InferField) => {
                if (field?.type === "richtext") {
                  imports.push(["MarkdownField", "@refinedev/antd"]);
            
                  const dataIndex =
            Severity: Minor
            Found in packages/inferencer/src/inferencers/antd/list.tsx - About 1 hr to fix

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

                const dateFields = (field: InferField) => {
                  if (field.type === "date") {
                    imports.push(["DatePicker", "antd"], ["dayjs", "dayjs", true]);
              
                    if (field.multiple) {
              Severity: Minor
              Found in packages/inferencer/src/inferencers/antd/create.tsx - About 1 hr to fix

                Function handleMouseMove has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const handleMouseMove = (e: MouseEvent) => {
                      if (resizing?.[1] === "x") {
                        const diff = e.clientX - (resizePosition?.x ?? e.clientX);
                        const newWidth =
                          panelSize.width + (resizing === "lx" ? -diff : diff) * 2;
                Severity: Minor
                Found in packages/devtools/src/components/resizable-pane.tsx - About 1 hr to fix

                  Function createResourceRoutes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const createResourceRoutes = (resources: ResourceProps[]) => {
                    const routes = resources.flatMap((resource) => {
                      const actions: {
                        action: Action;
                        element: React.ComponentType<any>;
                  Severity: Minor
                  Found in packages/react-router-v6/src/create-resource-routes.tsx - About 1 hr to fix

                    Function Header has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const Header: React.FC<RefineLayoutHeaderProps> = () => {
                      const authProvider = useActiveAuthProvider();
                      const { data: user } = useGetIdentity({
                        v3LegacyAuthProviderCompatible: Boolean(authProvider?.isLegacy),
                      });
                    Severity: Minor
                    Found in packages/mui/src/components/layout/header/index.tsx - About 1 hr to fix

                      Function createTreeView has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const createTreeView = (
                        resources: IResourceItem[] | IMenuItem[],
                      ): ITreeMenu[] | ITreeMenu[] => {
                        const tree = [];
                        const resourcesRouteObject: { [key: string]: any } = {};

                        Function asyncDebounce has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const asyncDebounce = <T extends (...args: any[]) => any>(
                          func: T,
                          wait = 1000,
                          cancelReason?: string,
                        ): DebouncedFunction<T> => {
                        Severity: Minor
                        Found in packages/core/src/definitions/helpers/async-debounce/index.ts - About 1 hr to fix

                          Function prepareItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              (item: FlatTreeItem): TreeMenuItem | undefined => {
                                if (item?.meta?.hide ?? item?.options?.hide) return undefined;
                                if (!item?.list && item.children.length === 0) return undefined;
                          
                                const composed = item.list
                          Severity: Minor
                          Found in packages/core/src/hooks/menu/useMenu.tsx - About 1 hr to fix

                            Function flattenObjectKeys has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const flattenObjectKeys = (obj: any, prefix = "") => {
                              if (!isNested(obj)) {
                                return {
                                  [prefix]: obj,
                                };
                            Severity: Minor
                            Found in packages/core/src/definitions/helpers/flatten-object-keys/index.ts - About 1 hr to fix

                              Function fn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  const fn = useCallback(() => {
                                    const parsedSearch = qs.parse(search, { ignoreQueryPrefix: true });
                              
                                    const combinedParams = {
                                      ...inferredParams,
                              Severity: Minor
                              Found in packages/remix-router/src/bindings.tsx - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language