hyper-tuner/hyper-tuner-cloud

View on GitHub
src/components/Tune/Dialog.tsx

Summary

Maintainability
D
1 day
Test Coverage

Function Dialog has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

const Dialog = ({
  ui,
  config,
  tune,
  url,
Severity: Minor
Found in src/components/Tune/Dialog.tsx - About 5 hrs 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 Dialog.tsx has 325 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { QuestionCircleOutlined } from '@ant-design/icons';
import {
  Config as ConfigType,
  ConstantTypes,
  Curve as CurveType,
Severity: Minor
Found in src/components/Tune/Dialog.tsx - About 3 hrs to fix

    Function generatePanelsComponents has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          panels.map((panel: RenderedPanel) => {
            // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
            if (panel.type === PanelTypes.FIELDS && panel.fields.length === 0) {
              return null;
            }
    Severity: Major
    Found in src/components/Tune/Dialog.tsx - About 3 hrs to fix

      Function panels has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const panels = Object.keys(resolvedDialogs).map((dialogName: string): RenderedPanel => {
          const currentDialog: DialogType | CurveType | TableType = resolvedDialogs[dialogName];
          let type = PanelTypes.CURVE;
          let fields: FieldType[] = [];
      
      
      Severity: Minor
      Found in src/components/Tune/Dialog.tsx - About 1 hr to fix

        Function resolveDialogs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const resolveDialogs = (source: DialogsType, dialogName: string) => {
            // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
            if (!source[dialogName]) {
              return;
            }
        Severity: Minor
        Found in src/components/Tune/Dialog.tsx - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

            return (
              <div ref={containerRef} className="large-container">
                {renderHelp(dialogConfig.help)}
                <Form labelCol={{ span: 10 }} wrapperCol={{ span: 10 }}>
                  <Row gutter={20}>{panelsComponents}</Row>
          Severity: Major
          Found in src/components/Tune/Dialog.tsx - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status