pankod/refine

View on GitHub

Showing 580 of 800 total issues

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

  const urlFields = (field: InferField) => {
    if (field.type === "url") {
      imports.push(["UrlField", "@refinedev/chakra-ui"]);

      const id = `id: "${field.key}"`;
Severity: Minor
Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx - About 1 hr to fix

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

      const booleanFields = (field: InferField) => {
        if (field?.type === "boolean") {
          const id = `id: "${field.key}"`;
          const accessorKey = getAccessorKey(field);
          const header = `header: ${translatePrettyString({
    Severity: Minor
    Found in packages/inferencer/src/inferencers/headless/list.tsx - About 1 hr to fix

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

        const dateFields = (field: InferField) => {
          if (field.type === "date") {
            imports.push(["DateField", "@refinedev/chakra-ui"]);
      
            const id = `id: "${field.key}"`;
      Severity: Minor
      Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx - About 1 hr to fix

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

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

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

            const booleanFields = (field: InferField) => {
              if (field?.type === "boolean") {
                imports.push(["BooleanField", "@refinedev/chakra-ui"]);
          
                const id = `id: "${field.key}"`;
          Severity: Minor
          Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx - About 1 hr to fix

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

              const booleanFields = (field: InferField) => {
                if (field?.type === "boolean") {
                  imports.push(["BooleanField", "@refinedev/mantine"]);
            
                  const id = `id: "${field.key}"`;
            Severity: Minor
            Found in packages/inferencer/src/inferencers/mantine/list.tsx - About 1 hr to fix

              Function LoadingComponent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                () => {
                  const [dots, setDots] = React.useState(0);
              
                  React.useEffect(() => {
                    if (typeof window !== "undefined") {
              Severity: Minor
              Found in packages/inferencer/src/inferencers/headless/loading.tsx - About 1 hr to fix

                Function ReadyPage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const ReadyPage: React.FC<RefineReadyPageProps> = () => {
                  return (
                    <Row align="middle" justify="center" style={styles.root}>
                      <Col style={{ textAlign: "center" }}>
                        <img
                Severity: Minor
                Found in packages/antd/src/components/pages/ready/index.tsx - About 1 hr to fix

                  Function postTransform has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function postTransform(files: any, flags: any) {
                    const rootDir = path.join(process.cwd(), files[0]);
                    const packageJsonPath = path.join(rootDir, "package.json");
                    const useYarn = checkPackageLock(rootDir) === "yarn.lock";
                    let packageJsonData;
                  Severity: Minor
                  Found in packages/codemod/src/transformations/refine2-to-refine3.ts - About 1 hr to fix

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

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

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

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

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

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

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

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

                            Function renderSection has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const renderSection = (key: keyof Filters) => {
                                const value = filters[key];
                                const mapValue = typeof value === "string" ? [value] : value;
                            
                                if (!value || value.length === 0) {

                              Function addBreadcrumb has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                const addBreadcrumb = (parentName: string | IResourceItem) => {
                                  const parentResource =
                                    typeof parentName === "string"
                                      ? pickResource(parentName, resources, routerType === "legacy") ?? {
                                          name: parentName,
                              Severity: Minor
                              Found in packages/core/src/hooks/breadcrumb/index.ts - About 1 hr to fix

                                Function renameUseFormQueryResultAndMutationResult has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const renameUseFormQueryResultAndMutationResult = (
                                  j: JSCodeshift,
                                  source: Collection,
                                ) => {
                                  const renameProperties = (prop) => {

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

                                    Function useNotificationProvider has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const useNotificationProvider = (): NotificationProvider => {
                                      const { notification: notificationFromContext } = App.useApp();
                                      const notification =
                                        "open" in notificationFromContext
                                          ? notificationFromContext
                                    Severity: Minor
                                    Found in packages/antd/src/providers/notificationProvider/index.tsx - About 1 hr to fix

                                      Function useQuerySubscription has 44 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

                                        Function ProjectIdFixBanner has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        export const ProjectIdFixBanner = () => {
                                          const [projectId, setProjectId] = React.useState<string | null>(null);
                                          const [modalVisible, setModalVisible] = React.useState(false);
                                          const [status, setStatus] = React.useState<
                                            "hidden" | "warning" | "fixing" | "success"
                                        Severity: Minor
                                        Found in packages/devtools-ui/src/components/project-id-fix-banner.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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language