jiahaog/nativefier

View on GitHub

Showing 79 of 148 total issues

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

function getExecutableArch(
  exeBytes: Uint8Array,
  platform: string,
): string | undefined {
  switch (platform) {
Severity: Minor
Found in src/helpers/upgrade/executableHelpers.ts - About 1 hr to fix

    Function findUpgradeApp has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function findUpgradeApp(upgradeFrom: string): UpgradeAppInfo | null {
      const searchDir = dirExists(upgradeFrom)
        ? upgradeFrom
        : path.dirname(upgradeFrom);
      log.debug(`Looking for old options file in ${searchDir}`);
    Severity: Minor
    Found in src/helpers/upgrade/upgrade.ts - About 1 hr to fix

      Function _logger has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      function _logger(
        logFunc: (...args: unknown[]) => void,
        level: loglevel.LogLevelNumbers,
        ...args: unknown[]
      ): void {
      Severity: Minor
      Found in app/src/helpers/loggingHelper.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 getLatestSafariVersion has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export async function getLatestSafariVersion(
        url = SAFARI_VERSIONS_HISTORY_URL,
      ): Promise<SafariVersion> {
        try {
          log.debug('Grabbing apple version data from', url);
      Severity: Minor
      Found in src/infer/browsers/inferSafariVersion.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 getDefaultWindowOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getDefaultWindowOptions(
        options: WindowOptions,
      ): BrowserWindowConstructorOptions {
        const browserwindowOptions: BrowserWindowConstructorOptions = {
          ...options.browserwindowOptions,
      Severity: Minor
      Found in app/src/helpers/windowHelpers.ts - About 1 hr to fix

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

            prepend: (actions: contextMenu.Actions, params: ContextMenuParams) => {
              log.debug('contextMenu.prepend', { actions, params });
              const items = [];
              if (params.linkURL && window) {
                items.push({
        Severity: Minor
        Found in app/src/components/contextMenu.ts - About 1 hr to fix

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

          function findSync(
            pattern: RegExp,
            basePath: string,
            limitSearchToDirectories = false,
          ): string[] {
          Severity: Minor
          Found in app/src/helpers/inferFlash.ts - About 1 hr to fix

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

            function getInfoPListOptions(
              appResourcesDir: string,
              priorOptions: NativefierOptions,
            ): NativefierOptions {
              if (!fileExists(path.join(appResourcesDir, '..', '..', 'Info.plist'))) {
            Severity: Minor
            Found in src/helpers/upgrade/upgrade.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 createMainWindow has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            export async function createMainWindow(
              nativefierOptions: OutputOptions,
              setDockBadge: (value: number | string, bounce?: boolean) => void,
            ): Promise<BrowserWindow> {
              const options = { ...nativefierOptions };
            Severity: Minor
            Found in app/src/components/mainWindow.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 prepareElectronApp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function prepareElectronApp(
              src: string,
              dest: string,
              options: AppOptions,
            ): Promise<void> {
            Severity: Minor
            Found in src/build/prepareElectronApp.ts - About 1 hr to fix

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

                    bookmarksMenuConfig.bookmarks.map((bookmark) => {
                      switch (bookmark.type) {
                        case 'link':
                          if (!('title' in bookmark && 'url' in bookmark)) {
                            throw new Error(
              Severity: Minor
              Found in app/src/components/menu.ts - About 1 hr to fix

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

                function injectCSSIntoResponse(
                  details: OnResponseStartedListenerDetails,
                  cssToInject: string,
                ): Promise<string | undefined> {
                  const contentType =
                Severity: Minor
                Found in app/src/helpers/windowHelpers.ts - About 1 hr to fix

                  Function getChromeVersionForElectronVersion has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function getChromeVersionForElectronVersion(
                    electronVersion: string,
                    url = ELECTRON_VERSIONS_URL,
                  ): Promise<string> {
                    if (!electronVersion || electronVersion === DEFAULT_ELECTRON_VERSION) {
                  Severity: Minor
                  Found in src/infer/browsers/inferChromeVersion.ts - About 1 hr to fix

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

                      (function findSyncRecurse(base): void {
                        let children: string[];
                        try {
                          children = fs.readdirSync(base);
                        } catch (err: unknown) {
                    Severity: Minor
                    Found in app/src/helpers/inferFlash.ts - About 1 hr to fix

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

                      export function linkIsInternal(
                        currentUrl: string,
                        newUrl: string,
                        internalUrlRegex: string | RegExp | undefined,
                        isStrictInternalUrlsEnabled: boolean | undefined,
                      Severity: Minor
                      Found in app/src/helpers/helpers.ts - About 1 hr to fix

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

                        export function isUrlShellSafe(
                          urlToGo: string,
                        ): { blocked: false } | { blocked: true; reason: string } {
                          let url: URL;
                          try {
                        Severity: Minor
                        Found in app/src/helpers/helpers.ts - About 1 hr to fix

                          Function injectCSS has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function injectCSS(browserWindow: BrowserWindow): void {
                            const cssToInject = getCSSToInject();
                          
                            if (!cssToInject) {
                              return;
                          Severity: Minor
                          Found in app/src/helpers/windowHelpers.ts - About 1 hr to fix

                            Function setupScreenSharePickerElement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function setupScreenSharePickerElement(
                              id: string,
                              sources: Electron.DesktopCapturerSource[],
                            ): void {
                              const selectionElem = document.createElement('div');
                            Severity: Minor
                            Found in app/src/preload.ts - About 1 hr to fix

                              Function copyIconsIfNecessary has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function copyIconsIfNecessary(
                                options: AppOptions,
                                appPath: string,
                              ): Promise<void> {
                                log.debug('Copying icons if necessary');
                              Severity: Minor
                              Found in src/build/buildNativefierApp.ts - About 1 hr to fix

                                Function setupCloseEvent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function setupCloseEvent(options: OutputOptions, window: BrowserWindow): void {
                                  window.on('close', (event: Event) => {
                                    log.debug('mainWindow.close', event);
                                    if (window.isFullScreen()) {
                                      if (nativeTabsSupported()) {
                                Severity: Minor
                                Found in app/src/components/mainWindow.ts - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language