teableio/teable

View on GitHub

Showing 671 of 671 total issues

Avoid too many return statements within this function.
Open

        return {
          ...res,
          props: {
            ...(await res.props),
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
Severity: Major
Found in apps/nextjs-app/src/lib/ensureLogin.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return {
              notFound: true,
            };
    Severity: Major
    Found in apps/nextjs-app/src/lib/withAuthSSR.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return a.pos - b.pos;
      Severity: Major
      Found in apps/nextjs-app/src/lib/i18n/acceptHeader.ts - About 30 mins to fix

        Function VirtualizedInfiniteTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const VirtualizedInfiniteTable = <T extends { [key: string]: unknown }>(
          props: IVirtualizedInfiniteTableProps<T>
        ) => {
          const { rows, columns, className, fetchNextPage } = props;
          const { t } = useTranslation();
        Severity: Minor
        Found in packages/sdk/src/components/table/VirtualizedInfiniteTable.tsx - About 25 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 OverflowTooltip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const OverflowTooltip = (props: IOverflowTooltipProps) => {
          const { text = '', maxLine = 1, className, tooltipClassName, onClick } = props;
          const [isOverflow, setOverflow] = useState(false);
          const contentRef = useRef<HTMLDivElement>(null);
        
        
        Severity: Minor
        Found in packages/sdk/src/components/cell-value/components/OverflowTooltip.tsx - About 25 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 checkRegion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          checkRegion: (cell: IImageCell, props: ICellClickProps, _shouldCalculate?: boolean) => {
            const { data, readonly } = cell;
            const { width, height, theme, isActive, hoverCellPosition } = props;
            const editable = !readonly && isActive;
        
        

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

        const getSnippetsForTargets = function (targets, snippet, mimeType) {
          const snippets = [];
          for (let j in targets) {
            const target = formatTarget(targets[j]);
            if (!target) throw new Error('Invalid target: ' + targets[j]);
        Severity: Minor
        Found in packages/openapi/src/openapi-snippet/index.js - About 25 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 TextEditorBase has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const TextEditorBase: ForwardRefRenderFunction<IEditorRef<string>, ITextEditor> = (props, ref) => {
          const { value, options, onChange, className, readonly, style, saveOnBlur = true } = props;
          const [text, setText] = useState<string>(value || '');
          const inputRef = useRef<HTMLInputElement | null>(null);
          const showAs = options.showAs;
        Severity: Minor
        Found in packages/sdk/src/components/editor/text/Editor.tsx - About 25 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 InfiniteTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const InfiniteTable = <T extends { [key: string]: unknown }>(
          props: IInfiniteTableProps<T>
        ) => {
          const { rows, columns, className, fetchNextPage } = props;
        
        
        Severity: Minor
        Found in packages/sdk/src/components/table/InfiniteTable.tsx - About 25 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 loadImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          private loadImage(url: string, col: number, row: number, key: string) {
            let loaded = false;
            const img = imgPool.pop() ?? new Image();
        
            let canceled = false;
        Severity: Minor
        Found in packages/sdk/src/components/grid/managers/image-manager/ImageManager.ts - About 25 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 expand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          public expand(range: IRange): CombinedSelection {
            switch (this.type) {
              case SelectionRegionType.Rows:
              case SelectionRegionType.Columns: {
                let hasOverlap = false;

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

        const CodeEditorBase: ForwardRefRenderFunction<ICodeEditorRef, ICodeEditorProps> = (props, ref) => {
          const { value = '', extensions = emptyExtensions, onChange, onSelectionChange } = props;
          const editorRef = useRef<HTMLDivElement | null>(null);
          const editorViewRef = useRef<EditorView | null>(null);
        
        
        Severity: Minor
        Found in packages/sdk/src/components/editor/formula/components/CodeEditor.tsx - About 25 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 binarySearchIndexPoint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const binarySearchIndexPoint = (
          indexPoints: IGroupIndexCollection[],
          targetIndex: number
        ): IGroupIndexCollection | null => {
          let low = 0;
        Severity: Minor
        Found in packages/sdk/src/components/grid/utils/group.ts - About 25 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 useCommentCountMap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useCommentCountMap = (query?: IGetRecordsRo) => {
          const tableId = useTableId();
        
          const viewId = useViewId();
        
        
        Severity: Minor
        Found in packages/sdk/src/hooks/use-comment-count-map.ts - About 25 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 getParamsIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          public getParamsIndex() {
            const pathSize = this.pathNodes.length;
            const nearestFuncIndex = this.getNearestFunctionNodeIndex();
            if (nearestFuncIndex > -1 && pathSize) {
              const funcNode = this.pathNodes[nearestFuncIndex] as FunctionCallContext;
        Severity: Minor
        Found in packages/sdk/src/components/editor/formula/visitor.ts - About 25 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 drawGridHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const drawGridHeader = (ctx: CanvasRenderingContext2D, props: IGridHeaderDrawerProps) => {
          const { x, y, width, height, theme, rowControls, isChecked, isMultiSelectionEnable } = props;
          const {
            iconSizeXS,
            staticWhite,

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

        const UniverSheet = forwardRef<IUniverSheetRef, IUniverSheetProps>((props, ref) => {
          const {
            toolbarVisible = true,
            footerVisible = false,
            validate = false,
        Severity: Minor
        Found in plugins/src/app/sheet-form-view/components/sheet/UniverSheet.tsx - About 25 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 findNearestCellIndexBinary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          private findNearestCellIndexBinary(
            offset: number,
            low: number,
            high: number,
            itemType: ItemType

        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 6 (exceeds 5 allowed). Consider refactoring.
        Open

          checkRegion: (cell: IRatingCell, props: ICellClickProps, shouldCalculate?: boolean) => {
            const { data, max, readonly } = cell;
            if (readonly) return { type: CellRegionType.Blank };
            const { hoverCellPosition, height, theme } = props;
            const [x, y] = hoverCellPosition;

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

        export const SearchProvider: React.FC<ISearchProviderProps> = ({ children }) => {
          const [fieldId, setFieldId] = useState<string | undefined>();
          const [value, setValue] = useState<string | undefined>();
        
          const reset = useCallback(() => {
        Severity: Minor
        Found in packages/sdk/src/context/query/SearchProvider.tsx - About 25 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

        Severity
        Category
        Status
        Source
        Language