teableio/teable

View on GitHub
packages/sdk/src/components/editor/formula/Editor.tsx

Summary

Maintainability
D
2 days
Test Coverage

Function FormulaEditor has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

export const FormulaEditor: FC<IFormulaEditorProps> = (props) => {
  const { expression, onConfirm } = props;
  const fields = useFields({ withHidden: true, withDenied: true });
  const { resolvedTheme } = useTheme();
  const { t } = useTranslation();
Severity: Minor
Found in packages/sdk/src/components/editor/formula/Editor.tsx - About 1 day 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

File Editor.tsx has 399 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 { closeBracketsKeymap } from '@codemirror/autocomplete';
import { defaultKeymap, historyKeymap } from '@codemirror/commands';
import type { EditorSelection } from '@codemirror/state';
import { keymap } from '@codemirror/view';
Severity: Minor
Found in packages/sdk/src/components/editor/formula/Editor.tsx - About 4 hrs to fix

    Function FormulaEditor has 360 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    export const FormulaEditor: FC<IFormulaEditorProps> = (props) => {
      const { expression, onConfirm } = props;
      const fields = useFields({ withHidden: true, withDenied: true });
      const { resolvedTheme } = useTheme();
      const { t } = useTranslation();
    Severity: Major
    Found in packages/sdk/src/components/editor/formula/Editor.tsx - About 3 hrs to fix

      There are no issues that match your filters.

      Category
      Status