pankod/refine

View on GitHub

Showing 945 of 974 total issues

Function useNavigation has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

export const useNavigation = () => {
  const { resources } = useResource();
  const routerType = useRouterType();
  const { useHistory } = useRouterContext();
  const history = useHistory();
Severity: Minor
Found in packages/core/src/hooks/navigation/index.ts - About 1 day 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 renderer has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

export const renderer = ({
  resource,
  fields,
  meta,
  isCustomPage,
Severity: Minor
Found in packages/inferencer/src/inferencers/mantine/show.tsx - About 1 day 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 renderer has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

export const renderer = ({
  resource,
  fields,
  meta,
  isCustomPage,
Severity: Minor
Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 1 day 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 renderer has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

export const renderer = ({
  resource,
  fields,
  meta,
  isCustomPage,
Severity: Minor
Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 day 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 renderer has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

export const renderer = ({
  resource,
  fields,
  meta,
  isCustomPage,
Severity: Minor
Found in packages/inferencer/src/inferencers/mui/show.tsx - About 1 day 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 renderer has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

export const renderer = ({
  resource,
  fields,
  meta,
  isCustomPage,
Severity: Minor
Found in packages/inferencer/src/inferencers/headless/edit.tsx - About 1 day 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 dataProvider has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

const dataProvider = (client: GraphQLClient): Required<DataProvider> => {
  return {
    getList: async ({ resource, pagination, sorters, filters, meta }) => {
      const operation = camelcase(resource);

Severity: Minor
Found in packages/nestjs-query/src/dataProvider/index.ts - About 1 day 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 Monitor has 250 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Monitor = () => {
  const { ws } = React.useContext(DevToolsContext);
  const [activities, setActivities] = React.useState<Activity[]>([]);
  const [searchParams] = useSearchParams();

Severity: Major
Found in packages/devtools-ui/src/pages/monitor.tsx - About 1 day to fix

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

    export const ResizeHandleIcon = (props: React.SVGProps<SVGSVGElement>) => (
      <svg
        width={10}
        height={26}
        viewBox="0 0 10 26"
    packages/devtools-ui/src/components/icons/resize-handle.tsx on lines 3..27

    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 223.

    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

    export const ResizeHandleIcon = (props: React.SVGProps<SVGSVGElement>) => (
      <svg
        width={10}
        height={26}
        viewBox="0 0 10 26"
    Severity: Major
    Found in packages/devtools-ui/src/components/icons/resize-handle.tsx and 1 other location - About 1 day to fix
    packages/devtools/src/components/icons/resize-handle-icon.tsx on lines 3..27

    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 223.

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

      const createActionWithResource = async (resource: IResourceItem) => {
        const {
          name,
          label: deprecatedLabel,
          list,
    Severity: Major
    Found in packages/kbar/src/hooks/useRefineKbar/index.tsx - About 1 day to fix

      Function Edit has 230 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const Edit: React.FC<EditProps> = (props) => {
        const {
          children,
          resource: resourceFromProps,
          recordItemId,
      Severity: Major
      Found in packages/chakra-ui/src/components/crud/edit/index.tsx - About 1 day to fix

        Function ThemedSiderV2 has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
        Open

        export const ThemedSiderV2: React.FC<RefineThemedLayoutV2SiderProps> = ({
          Title: TitleFromProps,
          render,
          meta,
          activeItemDisabled = false,
        Severity: Minor
        Found in packages/mui/src/components/themedLayoutV2/sider/index.tsx - About 1 day 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 Show has 221 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Show: React.FC<ShowProps> = (props) => {
          const {
            children,
            resource: resourceFromProps,
            recordItemId,
        Severity: Major
        Found in packages/chakra-ui/src/components/crud/show/index.tsx - About 1 day to fix

          Function Show has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
          Open

          export const Show: React.FC<ShowProps> = (props) => {
            const {
              children,
              resource: resourceFromProps,
              recordItemId,
          Severity: Minor
          Found in packages/chakra-ui/src/components/crud/show/index.tsx - About 1 day 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 2 locations. Consider refactoring.
          Open

          describe("paramsFromCurrentPath", () => {
            it("returns an empty object if there are no params", () => {
              expect(paramsFromCurrentPath("/", "/")).toEqual({});
            });
          
          
          Severity: Major
          Found in packages/remix/src/params-from-current-path/index.test.ts and 1 other location - About 1 day to fix
          packages/nextjs-router/src/common/params-from-current-path/index.test.tsx on lines 3..33

          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 206.

          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

          describe("paramsFromCurrentPath", () => {
            it("returns an empty object if there are no params", () => {
              expect(paramsFromCurrentPath("/", "/")).toEqual({});
            });
          
          
          packages/remix/src/params-from-current-path/index.test.ts on lines 3..33

          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 206.

          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 Edit has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
          Open

          export const Edit: React.FC<EditProps> = (props) => {
            const {
              children,
              resource: resourceFromProps,
              recordItemId,
          Severity: Minor
          Found in packages/chakra-ui/src/components/crud/edit/index.tsx - About 1 day 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 ResourceComponent has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
          Open

          const ResourceComponent: React.FC<{ route: string }> = ({ route }) => {
            const { catchAll } = useRefineContext();
            const { useParams } = useRouterContext();
            const { resources } = useResource();
          
          
          Severity: Minor
          Found in packages/react-router-v6/src/legacy/routeProvider.tsx - About 1 day 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 ThemedSider has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
          Open

          export const ThemedSider: React.FC<RefineThemedLayoutSiderProps> = ({
            Title: TitleFromProps,
            render,
            meta,
            isSiderOpen,
          Severity: Minor
          Found in packages/mui/src/components/themedLayout/sider/index.tsx - About 1 day 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