teableio/teable

View on GitHub

Showing 671 of 671 total issues

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

  private matchUser(value: string, userSets: IUser[] = []) {
    let foundUser: IUser | null = null;
    for (const user of userSets) {
      const { id, name, email } = user;
      if (value === id || value === name || value === email) {
Severity: Minor
Found in packages/core/src/models/field/derivate/user.field.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 Sort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function Sort(props: ISortProps) {
  const { children, onChange, sorts: outerSorts } = props;
  const sortBaseRef = useRef<ISortBaseRef>(null);

  const view = useView();
Severity: Minor
Found in packages/sdk/src/components/sort/Sort.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 BaseProvider has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const BaseProvider: FC<IBaseProviderProps> = ({ children, serverData, fallback }) => {
  const { baseId } = useContext(AnchorContext);
  const { data: baseData } = useQuery({
    queryKey: ['base', baseId],
    queryFn: ({ queryKey }) =>
Severity: Minor
Found in packages/sdk/src/context/base/BaseProvider.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 inOp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public inOp(): InOpContext {
    const _localctx: InOpContext = new InOpContext(this._ctx, this.state);
    this.enterRule(_localctx, 16, Query.RULE_inOp);
    let _la: number;
    try {
Severity: Minor
Found in packages/core/src/query/parser/Query.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 pathMatcher has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function pathMatcher<T>(path: (string | number)[], matchList: string[]): T | null {
  if (path.length !== matchList.length) {
    return null;
  }

Severity: Minor
Found in packages/core/src/op-builder/common.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 (currentLineWidth + ellipsisWidth > maxWidth) {
            let tempLine = currentLine;
            let tempLineWidth = currentLineWidth;
            while (tempLineWidth + ellipsisWidth > maxWidth) {
              tempLine = tempLine.substring(0, tempLine.length - 1);
Severity: Major
Found in packages/sdk/src/components/grid/renderers/base-renderer/baseRenderer.ts - About 45 mins to fix

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

    export function useGridColumns(hasMenu?: boolean, hiddenFieldIds?: string[]) {
      const view = useView() as GridView | undefined;
      const originFields = useFields();
      const totalFields = useFields({ withHidden: true, withDenied: true });
      const fieldEditable = useFieldCellEditable();
    Severity: Minor
    Found in packages/sdk/src/components/grid-enhancements/hooks/use-grid-columns.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 shouldResetFieldValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const shouldResetFieldValue = (newOperator: string, oldOperator: string): boolean => {
      const getOperatorType = (operator: string) => {
        if (EMPTY_OPERATORS.includes(operator)) {
          return 'empty';
        }
    Severity: Minor
    Found in packages/sdk/src/components/filter/view-filter/utils.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 FilePreviewDialog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      (props, ref) => {
        const { files } = props;
        const filesRef = useRef<IFileItem[]>();
        const {
          currentFile,
    Severity: Minor
    Found in packages/ui-lib/src/base/file/preview/FilePreviewDialog.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 alterTableAddField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      private async alterTableAddField(dbTableName: string, fieldInstances: IFieldInstance[]) {
        for (let i = 0; i < fieldInstances.length; i++) {
          const { dbFieldType, dbFieldName, type, isLookup, unique, notNull } = fieldInstances[i];
    
          const alterTableQuery = this.knex.schema
    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

    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

      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

        Avoid deeply nested control flow statements.
        Open

              } else if (content[cursor] === _newline) {
                if (quoted) {
                  cell += _newline;
                } else {
                  endOfCell = true;
        Severity: Major
        Found in packages/core/src/utils/clipboard.ts - About 45 mins to fix

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

              async deleteLinkOptionsDependenciesByViewId(tableId: string, viewId: string) {
                const foreignFields = await this.getLinkForeignFields(tableId);
            
                for (const field of foreignFields) {
                  const { id: fieldId, tableId, options: rawOptions } = field;

            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 (quoted) {
                      cell += delimiter;
                    } else {
                      endOfCell = true;
                      break;
            Severity: Major
            Found in packages/core/src/utils/clipboard.ts - About 45 mins to fix

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

                appendBuilder(): Knex.QueryBuilder {
                  const queryBuilder = this.originQueryBuilder;
              
                  if (!this.aggregationFields || !this.aggregationFields.length) {
                    return queryBuilder;

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

              export async function updateMultipleOrders(params: {
                parentId: string;
                position: 'before' | 'after';
                itemLength: number;
                anchorItem: { id: string; order: number };
              Severity: Minor
              Found in apps/nestjs-backend/src/utils/update-order.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 eval has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                eval(
                  params: TypedValue<number | string | null | (number | string | null)[]>[]
                ): number | string | null {
                  let min: number | null = null;
              
              
              Severity: Minor
              Found in packages/core/src/formula/functions/numeric.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 eval has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                eval(
                  params: TypedValue<number | string | null | (number | string | null)[]>[]
                ): number | string | null {
                  let max: number | null = null;
              
              
              Severity: Minor
              Found in packages/core/src/formula/functions/numeric.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

              Severity
              Category
              Status
              Source
              Language