jiahaog/nativefier

View on GitHub

Showing 79 of 148 total issues

Function buildNativefierApp has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export async function buildNativefierApp(
  rawOptions: RawOptions,
): Promise<string> {
  // early-suppress potential logging before full options handling
  if (rawOptions.quiet) {
Severity: Minor
Found in src/build/buildNativefierApp.ts - 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 findSync has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function findSync(
  pattern: RegExp,
  basePath: string,
  limitSearchToDirectories = false,
): string[] {
Severity: Minor
Found in app/src/helpers/inferFlash.ts - 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 createTrayIcon has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function createTrayIcon(
  nativefierOptions: OutputOptions,
  mainWindow: BrowserWindow,
): Tray | undefined {
  const options = { ...nativefierOptions };
Severity: Major
Found in app/src/components/trayIcon.ts - About 2 hrs to fix

    File mainWindow.ts has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Function getAllowedIconFormats has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getAllowedIconFormats(platform: string): string[] {
        const hasIdentify = hasbin.sync('identify') || hasbin.sync('gm');
        const hasConvert = hasbin.sync('convert') || hasbin.sync('gm');
        const hasIconUtil = hasbin.sync('iconutil');
      
      
      Severity: Minor
      Found in src/helpers/helpers.ts - 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 getAllowedIconFormats has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getAllowedIconFormats(platform: string): string[] {
        const hasIdentify = hasbin.sync('identify') || hasbin.sync('gm');
        const hasConvert = hasbin.sync('convert') || hasbin.sync('gm');
        const hasIconUtil = hasbin.sync('iconutil');
      
      
      Severity: Major
      Found in src/helpers/helpers.ts - About 2 hrs to fix

        Function checkApp has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function checkApp(
          appRoot: string,
          inputOptions: RawOptions,
        ): Promise<void> {
          const arch = inputOptions.arch ? inputOptions.arch : inferArch();
        Severity: Major
        Found in src/integration-test.ts - About 2 hrs to fix

          Function convertIconIfNecessary has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function convertIconIfNecessary(options: AppOptions): void {
            if (!options.packager.icon) {
              log.debug('Option "icon" not set, skipping icon conversion.');
              return;
            }
          Severity: Major
          Found in src/build/buildIcon.ts - About 2 hrs to fix

            Function convertIconIfNecessary has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            export function convertIconIfNecessary(options: AppOptions): void {
              if (!options.packager.icon) {
                log.debug('Option "icon" not set, skipping icon conversion.');
                return;
              }
            Severity: Minor
            Found in src/build/buildIcon.ts - 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 setupSessionInteraction has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function setupSessionInteraction(window: BrowserWindow): void {
              // See API.md / "Accessing The Electron Session"
              ipcMain.on(
                'session-interaction',
                (event, request: SessionInteractionRequest) => {
            Severity: Major
            Found in app/src/components/mainWindow.ts - About 2 hrs to fix

              Function injectBookmarks has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function injectBookmarks(menuTemplate: MenuItemConstructorOptions[]): void {
                const bookmarkConfigPath = path.join(__dirname, '..', 'bookmarks.json');
              
                if (!fs.existsSync(bookmarkConfigPath)) {
                  return;
              Severity: Minor
              Found in app/src/components/menu.ts - About 2 hrs to fix

                Function getLatestSafariVersion has 50 lines of code (exceeds 25 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 2 hrs to fix

                  Function onNewWindowHelper has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function onNewWindowHelper(
                    options: WindowOptions,
                    setupWindow: (options: WindowOptions, window: BrowserWindow) => void,
                    details: HandlerDetails,
                    parent?: BrowserWindow,
                  Severity: Minor
                  Found in app/src/helpers/windowEvents.ts - About 2 hrs to fix

                    Function checkApp has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    async function checkApp(
                      appRoot: string,
                      inputOptions: RawOptions,
                    ): Promise<void> {
                      const arch = inputOptions.arch ? inputOptions.arch : inferArch();
                    Severity: Minor
                    Found in src/integration-test.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 createTrayIcon has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function createTrayIcon(
                      nativefierOptions: OutputOptions,
                      mainWindow: BrowserWindow,
                    ): Tray | undefined {
                      const options = { ...nativefierOptions };
                    Severity: Minor
                    Found in app/src/components/trayIcon.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 getInfoPListOptions has 46 lines of code (exceeds 25 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

                      Function injectBookmarks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function injectBookmarks(menuTemplate: MenuItemConstructorOptions[]): void {
                        const bookmarkConfigPath = path.join(__dirname, '..', 'bookmarks.json');
                      
                        if (!fs.existsSync(bookmarkConfigPath)) {
                          return;
                      Severity: Minor
                      Found in app/src/components/menu.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 setupScreenSharePicker has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function setupScreenSharePicker(
                        resolve: (value: MediaStream | PromiseLike<MediaStream>) => void,
                        reject: (reason?: unknown) => void,
                        sources: Electron.DesktopCapturerSource[],
                      ): void {
                      Severity: Minor
                      Found in app/src/preload.ts - About 1 hr to fix

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

                        export function initContextMenu(
                          options: OutputOptions,
                          window?: BrowserWindow,
                        ): void {
                          log.debug('initContextMenu');
                        Severity: Minor
                        Found in app/src/components/contextMenu.ts - About 1 hr to fix

                          Function onReady has a Cognitive Complexity of 13 (exceeds 5 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: Minor
                          Found in app/src/main.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

                          Severity
                          Category
                          Status
                          Source
                          Language