teableio/teable

View on GitHub

Showing 671 of 671 total issues

Function useGraph has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const useGraph = (ref: RefObject<HTMLDivElement>) => {
  const graphRef = useRef<IGraph>();
  const { resolvedTheme } = useTheme();

  useEffect(() => {
Severity: Minor
Found in apps/nextjs-app/src/features/app/blocks/graph/useGraph.tsx - About 45 mins 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 SpaceInnerPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const SpaceInnerPage: React.FC = () => {
  const router = useRouter();
  const queryClient = useQueryClient();
  const isCloud = useIsCloud();
  const ref = useRef<HTMLDivElement>(null);
Severity: Minor
Found in apps/nextjs-app/src/features/app/blocks/space/SpaceInnerPage.tsx - About 45 mins 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

Consider simplifying this complex logical expression.
Open

    if (options && chunkCb) {
      return new Promise((resolve, reject) => {
        let isFirst = true;
        let recordBuffer: unknown[][] = [];
        let isAbort = false;
Severity: Major
Found in apps/nestjs-backend/src/features/import/open-api/import.class.ts - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

          if (relationship === Relationship.ManyMany || relationship === Relationship.OneMany) {
            const newCellValue = cellContext.newValue as ILinkCellValue[] | undefined;
            const oldKey = foreignKeys?.map((key) => key.foreignId) ?? null;
            const newKey = newCellValue?.map((item) => item.id) ?? null;
    
    
    Severity: Major
    Found in apps/nestjs-backend/src/features/calculation/link.service.ts - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if (
            enableGlobalErrorLogging ||
            !(
              exception instanceof BadRequestException ||
              exception instanceof UnauthorizedException ||
      Severity: Major
      Found in apps/nestjs-backend/src/filter/global-exception.filter.ts - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

          if (typeof input === 'object' && input !== null) {
            const obj = input as IObjectType;
            return obj.id ?? obj.email ?? obj.title ?? obj.name ?? undefined;
          }
        Severity: Major
        Found in apps/nestjs-backend/src/features/record/typecast.validate.ts - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

              if (!selection || !cell || !isCell || !tableId || !viewId || !baseId) {
                return;
              }
          Severity: Major
          Found in apps/nextjs-app/src/features/app/blocks/graph/CellGraph.tsx - About 40 mins to fix

            Function getParameterCollectionIn has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            const getParameterCollectionIn = function (openApi, path, method, location, values) {
            Severity: Minor
            Found in packages/openapi/src/openapi-snippet/openapi-to-har.js - About 35 mins to fix

              Function getEndpointSnippets has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              const getEndpointSnippets = function (openApi, path, method, targets, values) {
              Severity: Minor
              Found in packages/openapi/src/openapi-snippet/index.js - About 35 mins to fix

                Function getViewAggregations has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    tableId: string,
                    viewId: string,
                    funcs: StatisticsFunc,
                    fieldId: string[],
                    groupBy?: IGroup
                Severity: Minor
                Found in apps/nestjs-backend/test/aggregation.e2e-spec.ts - About 35 mins to fix

                  Function getBaseUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const getBaseUrl = function (openApi, path, method) {
                    if (openApi.paths[path][method].servers) return openApi.paths[path][method].servers[0].url;
                    if (openApi.paths[path].servers) return openApi.paths[path].servers[0].url;
                    if (openApi.servers) return openApi.servers[0].url;
                  
                  
                  Severity: Minor
                  Found in packages/openapi/src/openapi-snippet/openapi-to-har.js - About 35 mins 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 drawGrid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const drawGrid = (
                    mainCanvas: HTMLCanvasElement,
                    cacheCanvas: HTMLCanvasElement,
                    props: ILayoutDrawerProps,
                    lastProps?: ILayoutDrawerProps

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

                  const LinkEditorMainBase: ForwardRefRenderFunction<ILinkEditorMainRef, ILinkEditorMainProps> = (
                    props,
                    forwardRef
                  ) => {
                    const { options, cellValue } = props;
                  Severity: Minor
                  Found in packages/sdk/src/components/editor/link/EditorMain.tsx - About 35 mins 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 ImagePreview has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const ImagePreview = () => {
                    const state = useImagePreviewState({ scrollSpeed: SCROLL_SPEED });
                  
                    const {
                      closeProps,

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

                  export const HideFieldsBase = (props: IHideFieldsBaseProps) => {
                    const { fields, hidden, footer, children, onChange, onOrderChange } = props;
                    const { t } = useTranslation();
                    const fieldStaticGetter = useFieldStaticGetter();
                  
                  
                  Severity: Minor
                  Found in packages/sdk/src/components/hide-fields/HideFieldsBase.tsx - About 35 mins 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 CellValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const CellValue = (props: ICellValueContainer) => {
                    const { field, value, maxWidth, maxLine, className, itemClassName, formatImageUrl } = props;
                    const { type, options, cellValueType } = field;
                  
                    switch (type) {
                  Severity: Minor
                  Found in packages/sdk/src/components/cell-value/CellValue.tsx - About 35 mins 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 computeTextPositions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const computeTextPositions = ({
                    ctx,
                    data,
                    rect,
                    theme,

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

                    checkRegion: (cell: ILinkCell, props: ICellClickProps, _shouldCalculate?: boolean) => {
                      const { hoverCellPosition, width, height, isActive, theme, activeCellBound } = props;
                      const [hoverX, originHoverY] = hoverCellPosition;
                      const { fontSizeSM } = theme;
                      const { data } = cell;

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

                  const getEslintFixCmd = ({
                    cwd,
                    files,
                    rules,
                    fix,
                  Severity: Minor
                  Found in lint-staged.common.js - About 35 mins 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 draw has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    draw: (cell: IImageCell, props: ICellRenderProps) => {
                      const { rect, columnIndex, rowIndex, theme, ctx, imageManager, isActive, spriteManager } =
                        props;
                      const { iconSizeSM, cellLineColor } = theme;
                      const { data, readonly } = cell;

                  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