pankod/refine

View on GitHub

Showing 959 of 983 total issues

Function Sider has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

export const Sider: React.FC<RefineLayoutSiderProps> = ({
  render,
  meta,
  Title: TitleFromProps,
}) => {
Severity: Minor
Found in packages/mantine/src/components/layout/sider/index.tsx - About 5 hrs 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 renderRelationFields has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderRelationFields = (field: InferField) => {
    if (field.relation && field.resource) {
      const variableName = getVariableName(field.key, "Data");
      const variableIsLoading = getVariableName(field.key, "IsLoading");

Severity: Major
Found in packages/inferencer/src/inferencers/mui/show.tsx - About 5 hrs to fix

    Function useExport has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useExport = <
      TData extends BaseRecord = BaseRecord,
      TVariables = any,
    >({
      resourceName,
    Severity: Minor
    Found in packages/core/src/hooks/export/index.ts - About 5 hrs 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

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

      const renderedFields: Array<string | undefined> = fields.map((field) => {
        switch (field?.type) {
          case "text":
          case "number":
            return basicFields(field);
    Severity: Major
    Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx and 3 other locations - About 5 hrs to fix
    packages/inferencer/src/inferencers/antd/list.tsx on lines 559..581
    packages/inferencer/src/inferencers/mantine/list.tsx on lines 738..760
    packages/inferencer/src/inferencers/mui/list.tsx on lines 774..796

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 139.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

      const renderedFields: Array<string | undefined> = fields.map((field) => {
        switch (field?.type) {
          case "text":
          case "number":
            return basicFields(field);
    Severity: Major
    Found in packages/inferencer/src/inferencers/mantine/list.tsx and 3 other locations - About 5 hrs to fix
    packages/inferencer/src/inferencers/antd/list.tsx on lines 559..581
    packages/inferencer/src/inferencers/chakra-ui/list.tsx on lines 761..783
    packages/inferencer/src/inferencers/mui/list.tsx on lines 774..796

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 139.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

      const renderedFields: Array<string | undefined> = fields.map((field) => {
        switch (field?.type) {
          case "text":
          case "number":
            return basicFields(field);
    Severity: Major
    Found in packages/inferencer/src/inferencers/mui/list.tsx and 3 other locations - About 5 hrs to fix
    packages/inferencer/src/inferencers/antd/list.tsx on lines 559..581
    packages/inferencer/src/inferencers/chakra-ui/list.tsx on lines 761..783
    packages/inferencer/src/inferencers/mantine/list.tsx on lines 738..760

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 139.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

      const renderedFields: Array<string | undefined> = fields.map((field) => {
        switch (field?.type) {
          case "text":
          case "number":
            return basicFields(field);
    Severity: Major
    Found in packages/inferencer/src/inferencers/antd/list.tsx and 3 other locations - About 5 hrs to fix
    packages/inferencer/src/inferencers/chakra-ui/list.tsx on lines 761..783
    packages/inferencer/src/inferencers/mantine/list.tsx on lines 738..760
    packages/inferencer/src/inferencers/mui/list.tsx on lines 774..796

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 139.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      return (
        <>
          <Box component="div" style={layoutStyles} {...(wrapperProps ?? {})}>
            <Container
              component="main"
    packages/mui/src/components/pages/auth/components/updatePassword/index.tsx on lines 180..207

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 137.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      return (
        <>
          <Box component="div" style={layoutStyles} {...(wrapperProps ?? {})}>
            <Container
              component="main"
    packages/mui/src/components/pages/auth/components/forgotPassword/index.tsx on lines 174..201

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 137.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export const Header = () => {
      const [connectedApp, setConnectedApp] = React.useState<string | null>(null);
      const { ws } = React.useContext(DevToolsContext);
    
      const fetchConnectedApp = React.useCallback(async () => {
    Severity: Major
    Found in packages/devtools-ui/src/components/header.tsx - About 5 hrs to fix

      Function transformer has 127 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default async function transformer(file: FileInfo, api: API) {
        const j = api.jscodeshift;
        const source = j(file.source);
      
        const hasRefineElement =
      Severity: Major
      Found in packages/cli/src/transformers/integrations/react-router.ts - About 5 hrs to fix

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

          const renderRelationFields = (field: InferField) => {
            if (field.relation && field.resource) {
              const variableName = getVariableName(field.key, "Data");
              const variableIsLoading = getVariableName(field.key, "IsLoading");
        
        
        Severity: Major
        Found in packages/inferencer/src/inferencers/headless/show.tsx - About 5 hrs to fix

          Function GitHubBanner has 124 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const GitHubBanner = () => {
            useEffect(() => {
              const styleTag = document.createElement("style");
              document.head.appendChild(styleTag);
              CSSRules.forEach((rule) =>
          Severity: Major
          Found in packages/core/src/components/gh-banner/index.tsx - About 4 hrs to fix

            Function Sider has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export const Sider: React.FC<RefineLayoutSiderProps> = ({
              Title: TitleFromProps,
              render,
              meta,
            }) => {
            Severity: Minor
            Found in packages/antd/src/components/layout/sider/index.tsx - About 4 hrs 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 ThemedSiderV2 has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export const ThemedSiderV2: React.FC<RefineThemedLayoutV2SiderProps> = ({
              Title: TitleFromProps,
              render,
              meta,
              fixed,
            Severity: Minor
            Found in packages/antd/src/components/themedLayoutV2/sider/index.tsx - About 4 hrs 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 useUpdatePassword has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export function useUpdatePassword<
              TVariables extends UpdatePasswordFormTypes = {},
            >({
              v3LegacyAuthProviderCompatible,
              mutationOptions,
            Severity: Minor
            Found in packages/core/src/hooks/auth/useUpdatePassword/index.ts - About 4 hrs 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 RemixRouteComponent has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export function RemixRouteComponent(
              this: { initialRoute?: string },
              { children: _children, ...rest }: PropsWithChildren<RemixRouteComponentProps>,
            ): React.ReactNode {
              const loaderData = useLoaderData<any>();
            Severity: Minor
            Found in packages/remix/src/legacy/routeComponent.tsx - About 4 hrs 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 renderRelationFields has 121 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const renderRelationFields = (field: InferField) => {
                if (field.relation && field.resource) {
                  const variableName = getVariableName(field.key, "Data");
                  const variableIsLoading = getVariableName(field.key, "IsLoading");
            
            
            Severity: Major
            Found in packages/inferencer/src/inferencers/mantine/show.tsx - About 4 hrs to fix

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

                const renderRelationFields = (field: InferField) => {
                  if (field.relation && field.resource) {
                    const variableName = getVariableName(field.key, "Data");
                    const variableIsLoading = getVariableName(field.key, "IsLoading");
              
              
              Severity: Major
              Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 4 hrs to fix

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

                  const renderRelationFields = (field: InferField) => {
                    if (field.relation && field.resource) {
                      const variableName = `${getVariableName(field.key, "Data")}?.data`;
                
                      if (Array.isArray(field.accessor)) {
                Severity: Major
                Found in packages/inferencer/src/inferencers/headless/list.tsx - About 4 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language