jiahaog/nativefier

View on GitHub

Showing 32 of 52 total issues

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

export function createMainWindow(
  nativefierOptions,
  onAppQuit,
  setDockBadge,
): BrowserWindow {
Severity: Major
Found in app/src/components/mainWindow.ts - About 1 day to fix

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

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

      Function createMainWindow has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

      export function createMainWindow(
        nativefierOptions,
        onAppQuit,
        setDockBadge,
      ): BrowserWindow {
      Severity: Minor
      Found in app/src/components/mainWindow.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 mainWindow.ts has 340 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as fs from 'fs';
      import * as path from 'path';
      
      import { BrowserWindow, shell, ipcMain, dialog, Event } from 'electron';
      import windowStateKeeper from 'electron-window-state';
      Severity: Minor
      Found in app/src/components/mainWindow.ts - About 4 hrs to fix

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

        #!/usr/bin/env node
        import 'source-map-support/register';
        
        import * as commander from 'commander';
        import * as dns from 'dns';
        Severity: Minor
        Found in src/cli.ts - About 3 hrs to fix

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

          export async function getOptions(rawOptions: any): Promise<AppOptions> {
            const options: AppOptions = {
              packager: {
                appCopyright: rawOptions.appCopyright,
                appVersion: rawOptions.appVersion,
          Severity: Minor
          Found in src/options/optionsMain.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

          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 createMenu has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          export function createMenu({
            nativefierVersion,
            appQuit,
            zoomIn,
            zoomOut,
          Severity: Minor
          Found in app/src/components/menu.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

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

          import { Menu, clipboard, shell, MenuItemConstructorOptions } from 'electron';
          
          export function createMenu({
            nativefierVersion,
            appQuit,
          Severity: Minor
          Found in app/src/components/menu.ts - About 2 hrs to fix

            Function getAllowedIconFormats has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

              export function getAllowedIconFormats(platform: string): string[] {
                const hasIdentify = hasbin.sync('identify');
                const hasConvert = hasbin.sync('convert');
                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 convertIconIfNecessary has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

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

                function pickElectronAppArgs(options: AppOptions): any {
                  return {
                    alwaysOnTop: options.nativefier.alwaysOnTop,
                    appCopyright: options.packager.appCopyright,
                    appVersion: options.packager.appVersion,
                Severity: Major
                Found in src/build/prepareElectronApp.ts - About 2 hrs to fix

                  Function createTrayIcon has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function createTrayIcon(
                    nativefierOptions,
                    mainWindow: BrowserWindow,
                  ): Tray {
                    const options = { ...nativefierOptions };
                  Severity: Minor
                  Found in app/src/components/trayIcon.ts - About 1 hr to fix

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

                    export async function convertIconIfNecessary(
                      options: AppOptions,
                    ): Promise<void> {
                      if (!options.packager.icon) {
                        log.debug('Option "icon" not set, skipping icon conversion.');
                    Severity: Minor
                    Found in src/build/buildIcon.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 onNewWindowHelper has 11 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      urlToGo: string,
                      disposition,
                      targetUrl: string,
                      internalUrls,
                      preventDefault,
                    Severity: Major
                    Found in app/src/components/mainWindowHelpers.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 buildNativefierApp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function buildNativefierApp(
                          rawOptions: NativefierOptions,
                        ): Promise<string> {
                          log.info('Processing options...');
                          const options = await getOptions(rawOptions);
                        Severity: Minor
                        Found in src/build/buildNativefierApp.ts - About 1 hr to fix

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

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

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

                            async function iconShellHelper(
                              shellScriptPath: string,
                              icoSource: string,
                              icoDestination: string,
                            ): Promise<string> {
                            Severity: Minor
                            Found in src/helpers/iconShellHelpers.ts - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language