teableio/teable

View on GitHub

Showing 671 of 671 total issues

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

  private async sendCommentNotify(
    tableId: string,
    recordId: string,
    commentId: string,
    notifyVo: { quoteId: string | null; content: string | null }
Severity: Minor
Found in apps/nestjs-backend/src/features/comment/comment-open-api.service.ts - 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 flatten has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const flatten = (arr: IUnionType[]) => {
  let result: IUnionType[] = [];

  for (const item of arr) {
    if (item !== null) {
Severity: Minor
Found in packages/core/src/formula/functions/array.ts - 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

Avoid deeply nested control flow statements.
Open

                            if (this._input.LA(1) === Token.EOF) {
                                this.matchedEOF = true;
                            }
Severity: Major
Found in packages/core/src/formula/parser/Formula.ts - About 45 mins to fix

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

      async getFieldsByQuery(tableId: string, query?: IGetFieldsQuery): Promise<IFieldVo[]> {
        const fieldsPlain = await this.prismaService.txClient().field.findMany({
          where: { tableId, deletedTime: null },
          orderBy: [
            {
    Severity: Minor
    Found in apps/nestjs-backend/src/features/field/field.service.ts - 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 getDerivateByLink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      private async getDerivateByLink(tableId: string, innerOpsMap: IOpsMap['key']) {
        const changes: ICellContext[] = [];
        for (const recordId in innerOpsMap) {
          for (const op of innerOpsMap[recordId]) {
            const context = RecordOpBuilder.editor.setRecord.detect(op);

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

      getLines(linesChunk: Buffer): Buffer[] {
        const delimiterLength = this._delimiterBuffer.length;
        const lines: Buffer[] = [];
        let delimiterHits = 0;
        let lastSplitIndex = 0;
    Severity: Minor
    Found in apps/nestjs-backend/src/features/import/open-api/delimiter-stream.ts - 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 updateRecordIndexes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      async updateRecordIndexes(
        tableId: string,
        recordsWithOrder: {
          id: string;
          order?: Record<string, number>;
    Severity: Minor
    Found in apps/nestjs-backend/src/features/record/record.service.ts - 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 getPreviewUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      async getPreviewUrl<T extends string | string[] = string | string[]>(
        bucket: string,
        token: T,
        meta?: { expiresIn?: number }
      ): Promise<T> {

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

      private calculateLink(
        field: LinkFieldDto,
        virtualField: IFieldInstance,
        record: IRecord,
        lookupValues: unknown
    Severity: Minor
    Found in apps/nestjs-backend/src/features/calculation/reference.service.ts - 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 buildLinkSelectedQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      async buildLinkSelectedQuery(
        queryBuilder: Knex.QueryBuilder,
        tableId: string,
        dbTableName: string,
        filterLinkCellSelected: [string, string] | string
    Severity: Minor
    Found in apps/nestjs-backend/src/features/record/record.service.ts - 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 getContextByDelete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      private async getContextByDelete(linkFieldRaws: Field[], recordIds: string[]) {
        const cellContextsMap: { [tableId: string]: ICellContext[] } = {};
    
        const keyToValue = (key: string | string[] | null) =>
          key ? (Array.isArray(key) ? key.map((id) => ({ id })) : { id: key }) : null;
    Severity: Minor
    Found in apps/nestjs-backend/src/features/calculation/link.service.ts - 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 updateRecordByApi has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      tableId: string,
      recordId: string,
      fieldId: string,
      newValue: unknown,
      expectStatus = 200,
    Severity: Minor
    Found in apps/nestjs-backend/test/utils/init-app.ts - About 45 mins to fix

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

      export const UnionShowAs: FC<IUnionShowAsProps> = (props) => {
        const { showAs, cellValueType, isMultipleCellValue, onChange } = props;
      
        const ShowAsComponent = useMemo(() => {
          if (cellValueType === CellValueType.Number) {

      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

      Avoid deeply nested control flow statements.
      Open

                if (!lowers.has(joined)) {
                  lowers.set(joined, { orig: preference, pos: pos++ });
                }
      Severity: Major
      Found in apps/nextjs-app/src/lib/i18n/acceptHeader.ts - About 45 mins to fix

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

        export const StatisticMenu = () => {
          const view = useView();
          const isTouchDevice = useIsTouchDevice();
          const { t } = useTranslation(tableConfig.i18nNamespaces);
          const { statisticMenu, closeStatisticMenu } = useGridViewStore();

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

        export const ShareFormLinkEditor = (props: IShareFormLinkEditorProps) => {
          const { cellValue, shareId, className, field, onChange } = props;
          const [open, setOpen] = useState(false);
          const { t } = useTranslation(tableConfig.i18nNamespaces);
        
        

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

        export const KanbanStack = forwardRef<VirtuosoHandle, IKanbanStackProps>((props, forwardRef) => {
          const { stack, cards, setCardMap } = props;
          const { t } = useTranslation(tableConfig.i18nNamespaces);
          const { stackField, permission, recordQuery } = useKanban() as Required<IKanbanContext>;
          const [skipIndex, setSkipIndex] = useState(0);

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

        export const SystemInfo: React.FC<{ field: Partial<IFieldVo> }> = ({ field }) => {
          const [show, setShow] = useLocalStorage<boolean>(LocalStorageKeys.FieldSystem);
          const { t } = useTranslation(['table']);
          if (!field.id) {
            return null;
        Severity: Minor
        Found in apps/nextjs-app/src/features/app/components/field-setting/SystemInfo.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 BaseSidebarHeaderLeft has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const BaseSidebarHeaderLeft = () => {
          const base = useBase();
          const router = useRouter();
          const [renaming, setRenaming] = useState<boolean>();
          const [baseName, setBaseName] = useState<string>(base.name);

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

            withAuthSSR<IViewPageProps>(async (context, ssrApi) => {
              const { tableId, viewId, baseId, recordId, fromNotify: notifyId } = context.query;
              let recordServerData;
              if (recordId) {
                if (notifyId) {
        Severity: Minor
        Found in apps/nextjs-app/src/pages/base/[baseId]/[tableId]/[viewId].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

        Severity
        Category
        Status
        Source
        Language