hyper-tuner/hyper-tuner-cloud

View on GitHub

Showing 212 of 214 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        <Col {...colProps}>
          <Item name="ignition">
            <AutoComplete
              options={autocompleteOptions.ignition}
              onSearch={(search) => searchAutocomplete('ignition', search)}
Severity: Major
Found in src/pages/Upload.tsx and 1 other location - About 2 hrs to fix
src/pages/Upload.tsx on lines 794..804

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          <Radio.Button
            value={buildTuneUrl(Routes.TUNE_LOGS)}
            disabled={(tuneData?.logFiles || []).length === 0}
          >
            <Space>
Severity: Major
Found in src/components/TopBar.tsx and 1 other location - About 2 hrs to fix
src/components/TopBar.tsx on lines 215..223

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 88.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          <Radio.Button
            value={buildTuneUrl(Routes.TUNE_DIAGNOSE)}
            disabled={(tuneData?.toothLogFiles || []).length === 0}
          >
            <Space>
Severity: Major
Found in src/components/TopBar.tsx and 1 other location - About 2 hrs to fix
src/components/TopBar.tsx on lines 206..214

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 88.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File Login.tsx has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  FacebookOutlined,
  GithubOutlined,
  GoogleOutlined,
  LockOutlined,
Severity: Minor
Found in src/pages/auth/Login.tsx - About 2 hrs to fix

    File App.tsx has 276 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { ClockCircleOutlined, ReloadOutlined } from '@ant-design/icons';
    import { INI } from '@hyper-tuner/ini';
    import * as Sentry from '@sentry/react';
    import { Layout, Modal, Result } from 'antd';
    import { ReactNode, Suspense, lazy, useCallback, useEffect, useState } from 'react';
    Severity: Minor
    Found in src/App.tsx - About 2 hrs to fix

      Function ready has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            ready(u) {
              chartInstances.push(u); // Add the current chart instance to the list
      
              xMin = u.scales.x.min ?? 0;
              xMax = u.scales.x.max ?? 0;
      Severity: Major
      Found in src/utils/uPlot/mouseZoomPlugin.ts - About 2 hrs to fix

        Function ActionsProvider has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        const ActionsProvider = (props: CommandPaletteProps) => {
          const { config, tune, navigation } = props;
          const navigate = useNavigate();
        
          const generateActions = useCallback(
        Severity: Minor
        Found in src/components/CommandPalette.tsx - About 2 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

        Function useServerStorage has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const useServerStorage = () => {
          const { getIni } = useDb();
        
          const buildFileUrl = (collection: Collections, recordId: string, filename: string) =>
            `${API_URL}/api/files/${collection}/${recordId}/${filename}`;
        Severity: Major
        Found in src/hooks/useServerStorage.ts - About 2 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  oldTune.logFiles.forEach(async (fileName: string) => {
                    tempLogFiles.push(await fetchFile(oldTune.id, fileName));
                    setDefaultLogFilesList((prev) => [
                      ...prev,
                      {
          Severity: Major
          Found in src/pages/Upload.tsx and 1 other location - About 2 hrs to fix
          src/pages/Upload.tsx on lines 545..555

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 83.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  oldTune.toothLogFiles.forEach(async (fileName: string) => {
                    tempToothLogFiles.push(await fetchFile(oldTune.id, fileName));
                    setDefaultToothLogFilesList((prev) => [
                      ...prev,
                      {
          Severity: Major
          Found in src/pages/Upload.tsx and 1 other location - About 2 hrs to fix
          src/pages/Upload.tsx on lines 531..541

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 83.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          File Diagnose.tsx has 264 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { FileTextOutlined, GlobalOutlined } from '@ant-design/icons';
          import { Badge, Divider, Grid, Layout, Progress, Space, Steps, Tabs, Typography } from 'antd';
          import { useCallback, useEffect, useRef, useState } from 'react';
          import PerfectScrollbar from 'react-perfect-scrollbar';
          import { connect } from 'react-redux';
          Severity: Minor
          Found in src/pages/Diagnose.tsx - About 2 hrs to fix

            Function generatePlotConfig has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                (
                  fieldsToPlot: Record<string, PlottableField>,
                  selectedFieldsLength: number,
                  plotSyncKey: string,
                ) => {
            Severity: Major
            Found in src/components/Logs/LogCanvas.tsx - About 2 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                        chartInstances.forEach((chartInstance) => {
                          chartInstance.batch(() => {
                            chartInstance.setScale('x', {
                              min: nxMin,
                              max: nxMax,
              Severity: Major
              Found in src/utils/uPlot/touchZoomPlugin.ts and 1 other location - About 2 hrs to fix
              src/utils/uPlot/mouseZoomPlugin.ts on lines 114..126

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                        chartInstances.forEach((chartInstance) => {
                          chartInstance.batch(() => {
                            chartInstance.setScale('x', {
                              min: nxMin,
                              max: nxMax,
              Severity: Major
              Found in src/utils/uPlot/mouseZoomPlugin.ts and 1 other location - About 2 hrs to fix
              src/utils/uPlot/touchZoomPlugin.ts on lines 84..96

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function loadData has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const loadData = async () => {
                    const logFileName = routeMatch?.params.fileName ?? '';
              
                    // user didn't upload any logs
                    if (tuneData && tuneData.logFiles.length === 0) {
              Severity: Major
              Found in src/pages/Logs.tsx - About 2 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  const siderProps = {
                    width: sidebarWidth,
                    collapsedWidth: collapsedSidebarWidth,
                    collapsible: true,
                    breakpoint: 'xl' as const,
                Severity: Major
                Found in src/pages/Logs.tsx and 1 other location - About 2 hrs to fix
                src/pages/Diagnose.tsx on lines 65..74

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 80.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  const siderProps = {
                    width: sidebarWidth,
                    collapsedWidth: collapsedSidebarWidth,
                    collapsible: true,
                    breakpoint: 'xl' as const,
                Severity: Major
                Found in src/pages/Diagnose.tsx and 1 other location - About 2 hrs to fix
                src/pages/Logs.tsx on lines 111..120

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 80.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                File Hub.tsx has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { ArrowRightOutlined, CopyOutlined, EditOutlined, StarFilled } from '@ant-design/icons';
                import { Button, Grid, Input, InputRef, Pagination, Space, Table, Typography } from 'antd';
                import { ColumnsType } from 'antd/lib/table';
                import debounce from 'lodash.debounce';
                import { useCallback, useEffect, useRef, useState } from 'react';
                Severity: Minor
                Found in src/pages/Hub.tsx - About 2 hrs to fix

                  Function ResetPasswordConfirmation has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const ResetPasswordConfirmation = () => {
                    const { confirmResetPassword } = useAuth();
                    const navigate = useNavigate();
                    const [form] = Form.useForm();
                    const [isLoading, setIsLoading] = useState(false);
                  Severity: Major
                  Found in src/pages/auth/ResetPasswordConfirmation.tsx - About 2 hrs to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                              <td
                                className="value"
                                key={`${axis}-${index}-${value}-${hue}${sat}${light}`}
                                style={{ backgroundColor: `hsl(${hue}, ${sat}%, ${light}%)` }}
                              >
                    Severity: Major
                    Found in src/components/Tune/Dialog/Curve/Table.tsx and 1 other location - About 2 hrs to fix
                    src/components/Tune/Dialog/Map3D.tsx on lines 43..49

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 76.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language