iterative/vscode-dvc

View on GitHub

Showing 55 of 167 total issues

Function replaceAnchors has a Cognitive Complexity of 12 (exceeds 6 allowed). Consider refactoring.
Open

const replaceAnchors = (
  value: unknown,
  anchorDefinitions: AnchorDefinitions
  // eslint-disable-next-line sonarjs/cognitive-complexity
): unknown => {
Severity: Minor
Found in webview/src/plots/components/vegaLite/util.ts - About 1 hr 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 BranchCellContent has 46 lines of code (exceeds 40 allowed). Consider refactoring.
Open

> = cell => {
  const {
    row: {
      original: { flatBranches = [] }
    }

    Function evaluate has 43 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

    const evaluate = <T extends string | number | boolean>(
      valueToEvaluate: T,
      operator: Operator,
      filterValue: T
    ): boolean => {
    Severity: Minor
    Found in extension/src/experiments/model/filterBy/index.ts - About 1 hr to fix

      Function getWebviewData has 43 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

        private async getWebviewData(): Promise<TPlotsData> {
          const selectedRevisions = this.plots.getSelectedRevisionDetails()
      
          const [
            cliError,
      Severity: Minor
      Found in extension/src/plots/webview/messages.ts - About 1 hr to fix

        Function TableHead has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring.
        Open

        export const TableHead = ({
          columnOrder,
          headerGroups,
          setColumnOrder,
          root,
        Severity: Minor
        Found in webview/src/experiments/components/table/header/TableHead.tsx - About 55 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 TableRow has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring.
        Open

        > = ({ row, isExpanded, className }): JSX.Element => {
          const changes = useSelector(
            (state: ExperimentsState) => state.tableData.changes
          )
          const dispatch = useDispatch()
        Severity: Minor
        Found in webview/src/experiments/components/table/body/Row.tsx - About 55 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 ColumnResizer has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring.
        Open

        export const ColumnResizer: React.FC<ColumnResizerProps> = ({
          columnIsResizing,
          resizerHeight,
          setMenuSuppressed,
          header
        Severity: Minor
        Found in webview/src/experiments/components/table/header/ColumnResizer.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

        Avoid too many return statements within this function.
        Open

            return quickPickOne(
              [...pipelines],
              'Select a Pipeline to Run Command Against'
            )
        Severity: Major
        Found in extension/src/pipeline/index.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return formatNumber(value)
          Severity: Major
          Found in extension/src/experiments/model/util.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return String(value)
            Severity: Major
            Found in extension/src/experiments/model/util.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return (
                  <div
                    data-testid="custom-plots"
                    id="custom-plots"
                    className={cx(styles.singleViewPlotsGrid, {
              Severity: Major
              Found in webview/src/plots/components/customPlots/CustomPlots.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return (
                    <EmptyState isFullScreen={false}>
                      <h1>Setup Complete</h1>
                      {children}
                      <p>
                Severity: Major
                Found in webview/src/setup/components/dvc/Dvc.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return (
                      <EmptyState isFullScreen={false}>
                        <h1>Setup Complete</h1>
                        <IconButton
                          appearance="primary"
                  Severity: Major
                  Found in webview/src/setup/components/experiments/Experiments.tsx - About 30 mins to fix

                    Function clickAndEnterProps has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
                    Open

                    } = (handler, textsForSelection = [], checkForTooltip = false) => ({
                      onClick: e => {
                        if (
                          isSelecting(textsForSelection) ||
                          (checkForTooltip && isTooltip(e.target as HTMLElement, ['BODY']))
                    Severity: Minor
                    Found in webview/src/util/props.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 collectFromParamsFile has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
                    Open

                    const collectFromParamsFile = (
                      acc: { path: string; value: Value | undefined }[],
                      key: string | undefined,
                      value: Value | ValueTree,
                      ancestors: string[] = []
                    Severity: Minor
                    Found in extension/src/experiments/model/modify/collect.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

                    Severity
                    Category
                    Status
                    Source
                    Language