pankod/refine

View on GitHub

Showing 963 of 987 total issues

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

                  export const useCode = (): UseCodeReturn => {
                    const { query, isReady } = useRouter();
                    const {
                      code: compressed,
                      disableScroll,
                  Severity: Minor
                  Found in packages/live-previews/src/utils/use-code.ts - 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 antdPagination has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          const antdPagination = (): false | TablePaginationConfig => {
                            if (isPaginationEnabled) {
                              return {
                                itemRender: (page, type, element) => {
                                  const link = createLinkForSyncWithLocation({
                        Severity: Minor
                        Found in packages/antd/src/hooks/table/useTable/useTable.ts - About 1 hr to fix

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

                              const antdPagination = (): false | PaginationConfig => {
                                if (isPaginationEnabled) {
                                  return {
                                    itemRender: (page, type, element) => {
                                      const link = createLinkForSyncWithLocation({
                            Severity: Minor
                            Found in packages/antd/src/hooks/list/useSimpleList/useSimpleList.ts - About 1 hr to fix

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

                                  onMutationError: async (error, _variables, _context) => {
                                    if (disableServerSideValidation) {
                                      onMutationErrorProp?.(error, _variables, _context);
                                      return;
                                    }
                              Severity: Minor
                              Found in packages/antd/src/hooks/form/useForm.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 RouteProvider has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export const RouteProvider = ({
                                      initialRoute,
                                    }: RouteProviderProps): JSX.Element => {
                                      const { resources } = useResource();
                                      const { catchAll, DashboardPage, LoginPage } = useRefineContext();
                                    Severity: Minor
                                    Found in packages/react-router-v6/src/legacy/routeProvider.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 useCode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export const useCode = (): UseCodeReturn => {
                                      const { query, isReady } = useRouter();
                                      const {
                                        code: compressed,
                                        disableScroll,
                                    Severity: Minor
                                    Found in packages/live-previews/src/utils/use-code.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 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