hyper-tuner/hyper-tuner-cloud

View on GitHub

Showing 79 of 214 total issues

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

    const loadData = async () => {
      const logFileName = routeMatch?.params.fileName;

      if (!logFileName) {
        return;
Severity: Minor
Found in src/pages/Diagnose.tsx - About 1 hr to fix

    Function evaluateExpression has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const evaluateExpression = (
      expression: string,
      tuneConstants: TuneConstantsType,
      config: ConfigType,
    ) => {
    Severity: Minor
    Found in src/utils/tune/expression.ts - About 1 hr to fix

      Function parse has 43 lines of code (exceeds 25 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 1 hr to fix

        Function parse has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public parse(onProgress: (percent: number) => void): this {
            let unitsIndex = 999;
            const lines = this.raw.trim().split('\n');
        
            for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
        Severity: Minor
        Found in src/utils/logs/MslLogParser.ts - About 1 hr to fix

          Function ResetPassword has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const ResetPassword = () => {
            const [form] = Form.useForm();
            const [isLoading, setIsLoading] = useState(false);
            const { initResetPassword } = useAuth();
            const navigate = useNavigate();
          Severity: Minor
          Found in src/pages/auth/ResetPassword.tsx - About 1 hr to fix

            Function mapSubMenuItems has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                (
                  rootMenuName: string,
                  subMenus: Record<string, SubMenuType | GroupMenuType | GroupChildMenuType>,
                  groupMenuName: string | null = null,
                ): ItemType[] => {
            Severity: Minor
            Found in src/components/Tune/SideBar.tsx - About 1 hr to fix

              Function keyboardZoomPlugin has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function keyboardZoomPlugin(options: ZoomPluginOptions = {}): uPlotPlugin {
                const { zoomFactor = 0.9, panFactor = 0.3 } = options;
              
                return {
                  hooks: {
              Severity: Minor
              Found in src/utils/uPlot/keyboardZoomPlugin.ts - About 1 hr to fix

                Function loadTune has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const loadTune = async (data: TunesResponse | null) => {
                    if (data === null) {
                      store.dispatch({ type: 'config/load', payload: null });
                      store.dispatch({ type: 'tune/load', payload: null });
                
                
                Severity: Minor
                Found in src/App.tsx - About 1 hr to fix

                  Function userAuthMenuItems has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const userAuthMenuItems = useMemo(() => {
                      return currentUser
                        ? [
                            {
                              key: 'profile',
                  Severity: Minor
                  Found in src/components/TopBar.tsx - About 1 hr to fix

                    Function uploadTune has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const uploadTune = (options: UploadRequestOption) => {
                        upload(
                          options,
                          (file) => {
                            setTuneFile(file);
                    Severity: Minor
                    Found in src/pages/Upload.tsx - About 1 hr to fix

                      Function uploadLogs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const uploadLogs = (options: UploadRequestOption) => {
                          upload(
                            options,
                            (file) => {
                              setLogFiles((prev) => [...prev, file]);
                      Severity: Minor
                      Found in src/pages/Upload.tsx - About 1 hr to fix

                        Function render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              render: (tuneId: string, record: TunesResponse) => {
                                const isOwner = currentUser?.id === record.author;
                                const size = isOwner ? 'small' : 'middle';
                        
                                return (
                        Severity: Minor
                        Found in src/pages/Hub.tsx - About 1 hr to fix

                          Function parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            public parse(onProgress: (percent: number) => void): this {
                              let unitsIndex = 999;
                              const lines = this.raw.trim().split('\n');
                          
                              for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
                          Severity: Minor
                          Found in src/utils/logs/MslLogParser.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 parseToothLogs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private parseToothLogs(raw: string): void {
                              this.resultTooth = [];
                          
                              raw.split('\n').forEach((line) => {
                                const trimmed = line.trim();
                          Severity: Minor
                          Found in src/utils/logs/TriggerLogsParser.ts - About 1 hr to fix

                            Function NewVersionPrompt has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const NewVersionPrompt = () => {
                              // fetch /version.json?v=timestamp every 10s
                              const { status, reloadPage } = useUpdateCheck({
                                type: 'interval',
                                interval: 10000,
                            Severity: Minor
                            Found in src/App.tsx - About 1 hr to fix

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

                                    const mapSubMenuItems = (
                                      rootMenuName: string,
                                      rootMenu: MenuType,
                                      subMenus: Record<string, SubMenuType | GroupMenuType | GroupChildMenuType>,
                                      groupMenuName: string | null = null,
                              Severity: Minor
                              Found in src/components/CommandPalette.tsx - About 1 hr to fix

                                Function fetchWithProgress has 30 lines of code (exceeds 25 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

                                  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 ready has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                          ready(u) {
                                            document.addEventListener('keydown', (e: KeyboardEvent) => {
                                              if (e.ctrlKey || e.metaKey) {
                                                return;
                                              }
                                    Severity: Minor
                                    Found in src/utils/uPlot/keyboardZoomPlugin.ts - About 1 hr to fix

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

                                        const uploadCustomIni = (options: UploadRequestOption) => {
                                          upload(
                                            options,
                                            (file) => {
                                              setCustomIniFile(file);
                                      Severity: Minor
                                      Found in src/pages/Upload.tsx - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language