pankod/refine

View on GitHub

Showing 580 of 800 total issues

Function renderRelationFields has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderRelationFields = (field: InferField) => {
    if (field.relation && field.resource) {
      imports.push(["Select", "antd"]);
      const variableName = getVariableName(field.key, "SelectProps");

Severity: Minor
Found in packages/inferencer/src/inferencers/antd/edit.tsx - About 2 hrs to fix

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

      const imageFields = (field: InferField) => {
        if (field.type === "image") {
          imports.push(
            ["Upload", "antd"],
            ["getValueFromEvent", "@refinedev/antd"],
    Severity: Minor
    Found in packages/inferencer/src/inferencers/antd/edit.tsx - About 2 hrs to fix

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

        const imageFields = (field: InferField) => {
          if (field.type === "image") {
            imports.push(
              ["Upload", "antd"],
              ["getValueFromEvent", "@refinedev/antd"],
      Severity: Minor
      Found in packages/inferencer/src/inferencers/antd/create.tsx - About 2 hrs to fix

        Function dateFields has 49 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/edit.tsx - About 1 hr to fix

          Function booleanFields has 49 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/edit.tsx - About 1 hr to fix

            Function Feed has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const Feed = () => {
              const [feed, setFeed] = React.useState<FeedType | null>(null);
            
              const fetchFeed = React.useCallback(async () => {
                try {
            Severity: Minor
            Found in packages/devtools-ui/src/components/feed.tsx - About 1 hr to fix

              Function addV3LegacyAuthProviderCompatibleTrueToAuthHooks has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const addV3LegacyAuthProviderCompatibleTrueToAuthHooks = (
                j: JSCodeshift,
                root: Collection<any>,
              ) => {
                const authHooks = root.find(j.CallExpression, {

                Function basicFields has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const basicFields = (field: InferField) => {
                    if (field && (field.type === "text" || field.type === "number")) {
                      const id = `id: "${field.key}"`;
                      const accessorKey = getAccessorKey(field);
                      const header = `header: ${translatePrettyString({
                Severity: Minor
                Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx - About 1 hr to fix

                  Function emailFields has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const emailFields = (field: InferField) => {
                      if (field.type === "email") {
                        if (field.multiple) {
                          const val = accessor("item", undefined, field.accessor);
                          return jsx`
                  Severity: Minor
                  Found in packages/inferencer/src/inferencers/headless/show.tsx - About 1 hr to fix

                    Function basicFields has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

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

                        const urlFields = (field: InferField) => {
                          if (field.type === "url") {
                            if (field.multiple) {
                              const val = accessor("item", undefined, field.accessor);
                              return jsx`
                      Severity: Minor
                      Found in packages/inferencer/src/inferencers/headless/show.tsx - About 1 hr to fix

                        Function useTelemetryData has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const useTelemetryData = (): ITelemetryData => {
                          const auth = useIsExistAuthentication();
                          const auditLogContext = useContext(AuditLogContext);
                          const { liveProvider } = useContext(LiveContext);
                          const routerContext = useContext(LegacyRouterContext);
                        Severity: Minor
                        Found in packages/core/src/hooks/useTelemetryData/index.ts - About 1 hr to fix

                          Function replaceImports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const replaceImports = (
                            content: string,
                            modules: Record<string, string> = {},
                          ): string => {
                            const matches = content.matchAll(packageRegex);
                          Severity: Minor
                          Found in packages/inferencer/src/utilities/replace-imports/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 useCode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const useCode = (): UseCodeReturn => {
                            const { query, isReady } = useRouter();
                            const {
                              code: encoded,
                              hash,
                          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 Refine has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const Refine: React.FC<RefineProps> = ({
                            legacyAuthProvider,
                            authProvider,
                            dataProvider,
                            legacyRouterProvider,
                          Severity: Minor
                          Found in packages/core/src/components/containers/refine/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 liveProvider has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const liveProvider = (client: Ably.Realtime): LiveProvider => {
                            return {
                              subscribe: ({ channel, types, params, callback }) => {
                                const channelInstance = client.channels.get(channel);
                          
                          
                          Severity: Minor
                          Found in packages/ably/src/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 urlFields has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

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

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

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

                                const dateFields = (field: InferField) => {
                                  if (field.type === "date") {
                                    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 emailFields has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const emailFields = (field: InferField) => {
                                    if (field.type === "email") {
                                      imports.push(["EmailField", "@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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language