pankod/refine

View on GitHub

Showing 561 of 707 total issues

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 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 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 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 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 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 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/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/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/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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language