hyper-tuner/hyper-tuner-cloud

View on GitHub

Showing 79 of 214 total issues

Function UploadPage has 812 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UploadPage = () => {
  const [form] = useForm<TunesRecord>();
  const routeMatch = useMatch(Routes.UPLOAD_WITH_TUNE_ID);

  const [isLoading, setIsLoading] = useState(false);
Severity: Major
Found in src/pages/Upload.tsx - About 4 days to fix

    File Upload.tsx has 911 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      CheckOutlined,
      CopyOutlined,
      EditOutlined,
      EyeOutlined,
    Severity: Major
    Found in src/pages/Upload.tsx - About 2 days to fix

      Function UploadPage has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
      Open

      const UploadPage = () => {
        const [form] = useForm<TunesRecord>();
        const routeMatch = useMatch(Routes.UPLOAD_WITH_TUNE_ID);
      
        const [isLoading, setIsLoading] = useState(false);
      Severity: Minor
      Found in src/pages/Upload.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

      Function Hub has 234 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Hub = () => {
        const { xs } = useBreakpoint();
        const { searchTunes } = useDb();
        const navigate = useNavigate();
        const [dataSource, setDataSource] = useState<TunesResponse[]>([]);
      Severity: Major
      Found in src/pages/Hub.tsx - About 1 day to fix

        Function Profile has 197 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Profile = () => {
          const [formProfile] = Form.useForm();
          const { currentUser, sendEmailVerification, updateUsername, refreshUser } = useAuth();
          const navigate = useNavigate();
          const { getUserTunes } = useDb();
        Severity: Major
        Found in src/pages/auth/Profile.tsx - About 7 hrs to fix

          Function useDb has 175 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const useDb = () => {
            const updateTune = async (id: string, data: TunesRecordPartial): Promise<void> => {
              try {
                await tunesCollection.update(id, data);
                return Promise.resolve();
          Severity: Major
          Found in src/hooks/useDb.ts - About 7 hrs to fix

            File Logs.tsx has 456 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { EditOutlined, FileTextOutlined, GlobalOutlined } from '@ant-design/icons';
            import { DatalogEntry, Logs as LogsType, OutputChannel } from '@hyper-tuner/types';
            import {
              Badge,
              Checkbox,
            Severity: Minor
            Found in src/pages/Logs.tsx - About 6 hrs to fix

              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

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

              const useDb = () => {
                const updateTune = async (id: string, data: TunesRecordPartial): Promise<void> => {
                  try {
                    await tunesCollection.update(id, data);
                    return Promise.resolve();
              Severity: Minor
              Found in src/hooks/useDb.ts - 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 CommandPalette.tsx has 371 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                CarOutlined,
                CloudUploadOutlined,
                FundOutlined,
                InfoCircleOutlined,
              Severity: Minor
              Found in src/components/CommandPalette.tsx - About 4 hrs to fix

                Function AuthProvider has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const AuthProvider = (props: { children: ReactNode }) => {
                  const { children } = props;
                  const [currentUser, setCurrentUser] = useState<UsersResponse | null>(null);
                  const [currentUserToken, setCurrentUserToken] = useState<string | null>(null);
                
                
                Severity: Major
                Found in src/contexts/AuthContext.tsx - About 4 hrs to fix

                  Function TopBar has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const TopBar = ({ tuneData }: { tuneData: TuneDataState | null }) => {
                    const { xs, sm, lg } = useBreakpoint();
                    const { pathname } = useLocation();
                    const { currentUser, logout } = useAuth();
                    const navigate = useNavigate();
                  Severity: Minor
                  Found in src/components/TopBar.tsx - About 4 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 TopBar.tsx has 354 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import {
                    CarOutlined,
                    CloudDownloadOutlined,
                    CloudUploadOutlined,
                    DesktopOutlined,
                  Severity: Minor
                  Found in src/components/TopBar.tsx - About 4 hrs to fix

                    Function publishTune has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const publishTune = async (values: TunesRecord) => {
                        setIsLoading(true);
                    
                        const vehicleName = values.vehicleName.trim();
                        const engineMake = values.engineMake.trim();
                    Severity: Major
                    Found in src/pages/Upload.tsx - About 4 hrs to fix

                      Function mouseZoomPlugin has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const mouseZoomPlugin = (options: ZoomPluginOptions = {}): uPlotPlugin => {
                        const { zoomFactor = 0.9 } = options;
                      
                        let xMin: number;
                        let xMax: number;
                      Severity: Major
                      Found in src/utils/uPlot/mouseZoomPlugin.ts - About 4 hrs to fix

                        Function Logs has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const Logs = ({
                          ui,
                          config,
                          loadedLogs,
                          tuneData,
                        Severity: Minor
                        Found in src/pages/Logs.tsx - About 3 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 AuthProvider has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const AuthProvider = (props: { children: ReactNode }) => {
                          const { children } = props;
                          const [currentUser, setCurrentUser] = useState<UsersResponse | null>(null);
                          const [currentUserToken, setCurrentUserToken] = useState<string | null>(null);
                        
                        
                        Severity: Minor
                        Found in src/contexts/AuthContext.tsx - About 3 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 Profile has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const Profile = () => {
                            const navigate = useNavigate();
                            const route = useMatch(Routes.USER_ROOT);
                            const { getUserTunes } = useDb();
                            const [page, setPage] = useState(1);
                          Severity: Major
                          Found in src/pages/User.tsx - About 3 hrs to fix

                            Function touchZoomPlugin has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const touchZoomPlugin = (): uPlotPlugin => {
                              return {
                                hooks: {
                                  init(u, _opts, _data) {
                                    const { over } = u;
                            Severity: Major
                            Found in src/utils/uPlot/touchZoomPlugin.ts - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language