jiahaog/nativefier

View on GitHub

Showing 28 of 56 total issues

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

function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
  const options = Object.assign({}, inpOptions);
  const mainWindowState = windowStateKeeper({
    defaultWidth: options.width || 1280,
    defaultHeight: options.height || 800,
Severity: Major
Found in app/src/components/mainWindow/mainWindow.js - About 1 day to fix

    Function default has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function(inpOptions) {
      const options = {
        dir: PLACEHOLDER_APP_DIR,
        name: inpOptions.name,
        targetUrl: normalizeUrl(inpOptions.targetUrl),
    Severity: Major
    Found in src/options/optionsMain.js - About 4 hrs to fix

      File mainWindow.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Function buildMain has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function buildMain(inpOptions, callback) {
          const options = Object.assign({}, inpOptions);
        
          // pre process app
          const tmpObj = tmp.dirSync({ mode: '0755', unsafeCleanup: true });
        Severity: Major
        Found in src/build/buildMain.js - About 2 hrs to fix

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

          function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
            const options = Object.assign({}, inpOptions);
            const mainWindowState = windowStateKeeper({
              defaultWidth: options.width || 1280,
              defaultHeight: options.height || 800,
          Severity: Minor
          Found in app/src/components/mainWindow/mainWindow.js - 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

          function createMenu({
            nativefierVersion,
            appQuit,
            zoomIn,
            zoomOut,
          Severity: Minor
          Found in app/src/components/menu/menu.js - 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 allowedIconFormats has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function allowedIconFormats(platform) {
            const hasIdentify = hasBinary.sync('identify');
            const hasConvert = hasBinary.sync('convert');
            const hasIconUtil = hasBinary.sync('iconutil');
          
          
          Severity: Major
          Found in src/helpers/helpers.js - About 2 hrs to fix

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

            function iconBuild(inpOptions, callback) {
              const options = Object.assign({}, inpOptions);
              const returnCallback = () => {
                callback(null, options);
              };
            Severity: Major
            Found in src/build/iconBuild.js - About 2 hrs to fix

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

              function allowedIconFormats(platform) {
                const hasIdentify = hasBinary.sync('identify');
                const hasConvert = hasBinary.sync('convert');
                const hasIconUtil = hasBinary.sync('iconutil');
              
              
              Severity: Minor
              Found in src/helpers/helpers.js - 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.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Menu, shell, clipboard } from 'electron';
              
              /**
               * @param nativefierVersion
               * @param appQuit
              Severity: Minor
              Found in app/src/components/menu/menu.js - About 2 hrs to fix

                File cli.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                #! /usr/bin/env node
                
                import 'source-map-support/register';
                import program from 'commander';
                import nativefier from './index';
                Severity: Minor
                Found in src/cli.js - About 2 hrs to fix

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

                  function createTrayIcon(inpOptions, mainWindow) {
                    const options = Object.assign({}, inpOptions);
                  
                    if (options.tray) {
                      const iconPath = getAppIcon();
                  Severity: Major
                  Found in app/src/components/trayIcon/trayIcon.js - About 2 hrs to fix

                    Function selectAppArgs has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function selectAppArgs(options) {
                      return {
                        name: options.name,
                        targetUrl: options.targetUrl,
                        counter: options.counter,
                    Severity: Major
                    Found in src/build/buildApp.js - About 2 hrs to fix

                      Function default has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function(inpOptions) {
                        const options = {
                          dir: PLACEHOLDER_APP_DIR,
                          name: inpOptions.name,
                          targetUrl: normalizeUrl(inpOptions.targetUrl),
                      Severity: Minor
                      Found in src/options/optionsMain.js - 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 maybeCopyScripts has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function maybeCopyScripts(srcs, dest) {
                        if (!srcs) {
                          return new Promise((resolve) => {
                            resolve();
                          });
                      Severity: Minor
                      Found in src/build/buildApp.js - About 1 hr to fix

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

                          tick(message) {
                            const {
                              remainder: prevRemainder,
                              message: prevMessage,
                              interval: prevInterval,
                        Severity: Minor
                        Found in src/helpers/dishonestProgress.js - About 1 hr to fix

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

                          function findSync(pattern, basePath, findDir) {
                            const matches = [];
                          
                            (function findSyncRecurse(base) {
                              let children;
                          Severity: Minor
                          Found in app/src/helpers/inferFlash.js - About 1 hr to fix

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

                            function checkApp(appPath, inputOptions, callback) {
                              try {
                                let relPathToConfig;
                            
                                switch (inputOptions.platform) {
                            Severity: Minor
                            Found in e2e/index.test.js - About 1 hr to fix

                              Function onNewWindowHelper has 9 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                urlToGo,
                                disposition,
                                targetUrl,
                                internalUrls,
                                preventDefault,
                              Severity: Major
                              Found in app/src/components/mainWindow/mainWindowHelpers.js - About 1 hr to fix

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

                                function initContextMenu(createNewWindow, createNewTab) {
                                  contextMenu({
                                    prepend: (params) => {
                                      const items = [];
                                      if (params.linkURL) {
                                Severity: Minor
                                Found in app/src/components/contextMenu/contextMenu.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language