teableio/teable

View on GitHub
apps/nextjs-app/src/features/app/blocks/view/grid/components/FieldMenu.tsx

Summary

Maintainability
D
1 day
Test Coverage

Function FieldMenu has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

export const FieldMenu = () => {
  const isTouchDevice = useIsTouchDevice();
  const view = useView() as GridView | undefined;
  const { filter, sort, group } = view || {};
  const tableId = useTableId();

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

File FieldMenu.tsx has 385 lines of code (exceeds 300 allowed). Consider refactoring.
Open

/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
import type { IFilter, IGroup, ISort } from '@teable/core';
import { getValidFilterOperators } from '@teable/core';
import {
  Trash,

    Function FieldMenu has 326 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    export const FieldMenu = () => {
      const isTouchDevice = useIsTouchDevice();
      const view = useView() as GridView | undefined;
      const { filter, sort, group } = view || {};
      const tableId = useTableId();

      There are no issues that match your filters.

      Category
      Status