jiahaog/nativefier

View on GitHub

Showing 79 of 148 total issues

Function generateMenu has 291 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function generateMenu(
  options: {
    disableDevTools: boolean;
    nativefierVersion: string;
    zoom?: number;
Severity: Major
Found in app/src/components/menu.ts - About 1 day to fix

    Function getOptions has 204 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export async function getOptions(rawOptions: RawOptions): Promise<AppOptions> {
      const options: AppOptions = {
        packager: {
          appCopyright: rawOptions.appCopyright,
          appVersion: rawOptions.appVersion,
    Severity: Major
    Found in src/options/optionsMain.ts - About 1 day to fix

      File menu.ts has 398 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as fs from 'fs';
      import path from 'path';
      
      import {
        BrowserWindow,
      Severity: Minor
      Found in app/src/components/menu.ts - About 5 hrs to fix

        Function getOptions has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function getOptions(rawOptions: RawOptions): Promise<AppOptions> {
          const options: AppOptions = {
            packager: {
              appCopyright: rawOptions.appCopyright,
              appVersion: rawOptions.appVersion,
        Severity: Minor
        Found in src/options/optionsMain.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 main.ts has 366 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import 'source-map-support/register';
        
        import fs from 'fs';
        import * as path from 'path';
        
        
        Severity: Minor
        Found in app/src/main.ts - About 4 hrs to fix

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

          export function getOptionsFromExecutable(
            appResourcesDir: string,
            priorOptions: NativefierOptions,
          ): NativefierOptions {
            const newOptions: NativefierOptions = { ...priorOptions };
          Severity: Minor
          Found in src/helpers/upgrade/executableHelpers.ts - 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

          Function getOptionsFromExecutable has 111 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getOptionsFromExecutable(
            appResourcesDir: string,
            priorOptions: NativefierOptions,
          ): NativefierOptions {
            const newOptions: NativefierOptions = { ...priorOptions };
          Severity: Major
          Found in src/helpers/upgrade/executableHelpers.ts - About 4 hrs to fix

            Function buildNativefierApp has 98 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function buildNativefierApp(
              rawOptions: RawOptions,
            ): Promise<string> {
              // early-suppress potential logging before full options handling
              if (rawOptions.quiet) {
            Severity: Major
            Found in src/build/buildNativefierApp.ts - About 3 hrs to fix

              File playwright-test.ts has 325 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { once } from 'events';
              import * as fs from 'fs';
              import * as path from 'path';
              
              import { Shell } from 'electron';
              Severity: Minor
              Found in src/playwright-test.ts - About 3 hrs to fix

                Function setupScreenSharePickerStyles has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function setupScreenSharePickerStyles(id: string): void {
                  const screenShareStyles = document.createElement('style');
                  screenShareStyles.id = id;
                  screenShareStyles.innerHTML = `
                  .desktop-capturer-selection {
                Severity: Major
                Found in app/src/preload.ts - About 3 hrs to fix

                  File windowEvents.test.ts has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  jest.mock('./helpers');
                  jest.mock('./windowEvents');
                  jest.mock('./windowHelpers');
                  
                  import { dialog, BrowserWindow, HandlerDetails, WebContents } from 'electron';
                  Severity: Minor
                  Found in app/src/helpers/windowEvents.test.ts - About 3 hrs to fix

                    File windowHelpers.ts has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import path from 'path';
                    
                    import {
                      dialog,
                      BrowserWindow,
                    Severity: Minor
                    Found in app/src/helpers/windowHelpers.ts - About 3 hrs to fix

                      Function createMainWindow has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export async function createMainWindow(
                        nativefierOptions: OutputOptions,
                        setDockBadge: (value: number | string, bounce?: boolean) => void,
                      ): Promise<BrowserWindow> {
                        const options = { ...nativefierOptions };
                      Severity: Major
                      Found in app/src/components/mainWindow.ts - About 3 hrs to fix

                        Function pickElectronAppArgs has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function pickElectronAppArgs(options: AppOptions): OutputOptions {
                          return {
                            accessibilityPrompt: options.nativefier.accessibilityPrompt,
                            alwaysOnTop: options.nativefier.alwaysOnTop,
                            appBundleId: options.packager.appBundleId,
                        Severity: Major
                        Found in src/build/prepareElectronApp.ts - About 3 hrs to fix

                          File helpers.test.ts has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { shell } from 'electron';
                          jest.mock('./windowHelpers');
                          
                          import {
                            cleanupPlainText,
                          Severity: Minor
                          Found in app/src/helpers/helpers.test.ts - About 3 hrs to fix

                            Function generateMenu has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function generateMenu(
                              options: {
                                disableDevTools: boolean;
                                nativefierVersion: string;
                                zoom?: number;
                            Severity: Minor
                            Found in app/src/components/menu.ts - 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 preload.ts has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /**
                             * Preload file that will be executed in the renderer process.
                             * Note: This needs to be attached **prior to imports**, as imports
                             * would delay the attachment till after the event has been raised.
                             */
                            Severity: Minor
                            Found in app/src/preload.ts - About 3 hrs to fix

                              File cli.test.ts has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import 'source-map-support/register';
                              
                              import { initArgs, parseArgs } from './cli';
                              import { parseJson } from './utils/parseUtils';
                              
                              
                              Severity: Minor
                              Found in src/cli.test.ts - About 2 hrs to fix

                                Function onReady has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function onReady(): Promise<void> {
                                  // Warning: `mainWindow` below is the *global* unique `mainWindow`, created at init time
                                  mainWindow = await createMainWindow(appArgs, setDockBadge);
                                
                                  createTrayIcon(appArgs, mainWindow);
                                Severity: Major
                                Found in app/src/main.ts - About 2 hrs to fix

                                  Function spawnApp has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    const spawnApp = async (
                                      playwrightConfig: NativefierOptions = { ...DEFAULT_CONFIG },
                                      awaitFirstWindow = true,
                                      preventNavigation = false,
                                    ): Promise<Page | undefined> => {
                                  Severity: Major
                                  Found in src/playwright-test.ts - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language