hyper-tuner/hyper-tuner-cloud

View on GitHub

Showing 79 of 214 total issues

Function rootReducer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const rootReducer = createReducer(initialState, (builder) => {
  builder
    .addCase(loadConfig, (state: AppState, action) => {
      state.config = action.payload;
    })
Severity: Minor
Found in src/store.ts - About 1 hr to fix

    Function fetchWithProgress has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const fetchWithProgress = async (
      url: string,
      onProgress?: OnProgress,
      signal?: AbortSignal,
    ): Promise<ArrayBuffer> => {
    Severity: Minor
    Found in src/utils/http.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 StarButton has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    const StarButton = ({ tuneData }: { tuneData: TuneDataState }) => {
      const navigate = useNavigate();
      const { currentUserToken } = useAuth();
      const { toggleStar, isStarredByMe } = useDb();
      const [currentStars, setCurrentStars] = useState(tuneData.stars);
    Severity: Minor
    Found in src/components/StarButton.tsx - 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 Diagnose has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    const Diagnose = ({
      ui,
      loadedToothLogs,
      tuneData,
    }: {
    Severity: Minor
    Found in src/pages/Diagnose.tsx - 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 searchTunes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const searchTunes = async (
        search: string,
        page: number,
        perPage: number,
      ): Promise<TunesResponseList> => {
    Severity: Minor
    Found in src/hooks/useDb.ts - 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

        Function Hub has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        const Hub = () => {
          const { xs } = useBreakpoint();
          const { searchTunes } = useDb();
          const navigate = useNavigate();
          const [dataSource, setDataSource] = useState<TunesResponse[]>([]);
        Severity: Minor
        Found in src/pages/Hub.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 SideBar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const SideBar = ({
          config,
          tune,
          ui,
          navigation,
        Severity: Minor
        Found in src/components/Tune/SideBar.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 clamp has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            nRange: number,
            nMin: number,
            nMax: number,
            fRange: number,
            fMin: number,
        Severity: Minor
        Found in src/utils/uPlot/mouseZoomPlugin.ts - About 45 mins to fix

          Function Profile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const Profile = () => {
            const [formProfile] = Form.useForm();
            const { currentUser, sendEmailVerification, updateUsername, refreshUser } = useAuth();
            const navigate = useNavigate();
            const { getUserTunes } = useDb();
          Severity: Minor
          Found in src/pages/auth/Profile.tsx - About 35 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 prepareConstDeclarations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          export const prepareConstDeclarations = (
            tuneConstants: TuneConstantsType,
            configPages: ConfigPageType[],
          ) =>
            Object.keys(tuneConstants)
          Severity: Minor
          Found in src/utils/tune/expression.ts - About 35 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 ResultItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            (
              {
                action,
                active,
                currentRootActionId,
          Severity: Minor
          Found in src/components/CommandPalette.tsx - About 35 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 touchZoomPlugin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const touchZoomPlugin = (): uPlotPlugin => {
            return {
              hooks: {
                init(u, _opts, _data) {
                  const { over } = u;
          Severity: Minor
          Found in src/utils/uPlot/touchZoomPlugin.ts - About 35 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 Tune has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const Tune = ({ config, tune }: { config: ConfigType | null; tune: TuneState | null }) => {
            const dialogMatch = useMatch(Routes.TUNE_DIALOG);
            const tuneRootMatch = useMatch(Routes.TUNE_TUNE);
            const groupMenuDialogMatch = useMatch(Routes.TUNE_GROUP_MENU_DIALOG);
            const { isConfigReady } = useConfig(config);
          Severity: Minor
          Found in src/pages/Tune.tsx - About 35 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 false;
          Severity: Major
          Found in src/utils/logs/TriggerLogsParser.ts - About 30 mins 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

              Function mouseZoomPlugin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const mouseZoomPlugin = (options: ZoomPluginOptions = {}): uPlotPlugin => {
                const { zoomFactor = 0.9 } = options;
              
                let xMin: number;
                let xMax: number;
              Severity: Minor
              Found in src/utils/uPlot/mouseZoomPlugin.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 checkMSL has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                private checkMSL() {
                  const lines = this.raw.split('\n');
                  for (let index = 0; index < lines.length; index++) {
                    if (lines[index].startsWith('Time') || lines[index].startsWith('RPM')) {
                      this.isMSLLogs = true;
              Severity: Minor
              Found in src/utils/logs/LogValidator.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                parse(buffer: ArrayBuffer): this {
                  const raw = new TextDecoder().decode(buffer);
                  const xml = new DOMParser().parseFromString(raw, 'text/xml');
                  const xmlPages = xml.getElementsByTagName('page');
                  const bibliography = (xml.getElementsByTagName('bibliography')[0] as any)?.attributes;
              Severity: Minor
              Found in src/utils/tune/TuneParser.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