jiahaog/nativefier

View on GitHub

Showing 56 of 56 total issues

Function selectAppArgs has 52 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      test('it should return the icon parameter', async () => {
        expect(inferIcon).toHaveBeenCalledTimes(0);
    
        const params = { icon: './icon.png' };
        await expect(icon(params)).resolves.toBe(params.icon);
    Severity: Major
    Found in src/options/fields/icon.test.js and 1 other location - About 1 hr to fix
    src/options/fields/userAgent.test.js on lines 6..11

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 70.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    test('when a userAgent parameter is passed', async () => {
      expect(inferUserAgent).toHaveBeenCalledTimes(0);
    
      const params = { userAgent: 'valid user agent' };
      await expect(userAgent(params)).resolves.toBe(params.userAgent);
    Severity: Major
    Found in src/options/fields/userAgent.test.js and 1 other location - About 1 hr to fix
    src/options/fields/icon.test.js on lines 11..16

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 70.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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 findSyncRecurse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                (function findSyncRecurse(base) {
                  let children;
                  try {
                    children = fs.readdirSync(base);
                  } catch (exception) {
              Severity: Minor
              Found in app/src/helpers/inferFlash.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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          {
                            label: 'Zoom In',
                            accelerator: (() => {
                              if (process.platform === 'darwin') {
                                return 'Command+=';
                  Severity: Major
                  Found in app/src/components/menu/menu.js and 1 other location - About 1 hr to fix
                  app/src/components/menu/menu.js on lines 147..158

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 57.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          {
                            label: 'Zoom Out',
                            accelerator: (() => {
                              if (process.platform === 'darwin') {
                                return 'Command+-';
                  Severity: Major
                  Found in app/src/components/menu/menu.js and 1 other location - About 1 hr to fix
                  app/src/components/menu/menu.js on lines 135..146

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 57.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Function iconBuild has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function iconBuild(inpOptions, callback) {
                    const options = Object.assign({}, inpOptions);
                    const returnCallback = () => {
                      callback(null, options);
                    };
                  Severity: Minor
                  Found in src/build/iconBuild.js - About 55 mins 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function maybeCopyScripts(srcs, dest) {
                    if (!srcs) {
                      return new Promise((resolve) => {
                        resolve();
                      });
                  Severity: Minor
                  Found in src/build/buildApp.js - About 55 mins 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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      case 'darwin':
                        formats.push('.icns');
                        if (pngToIcns) {
                          formats.push('.png');
                        }
                  Severity: Major
                  Found in src/helpers/helpers.js and 2 other locations - About 50 mins to fix
                  src/helpers/helpers.js on lines 76..84
                  src/helpers/helpers.js on lines 85..93

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      case 'win32':
                        formats.push('.ico');
                        if (pngToIco) {
                          formats.push('.png');
                        }
                  Severity: Major
                  Found in src/helpers/helpers.js and 2 other locations - About 50 mins to fix
                  src/helpers/helpers.js on lines 67..75
                  src/helpers/helpers.js on lines 76..84

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      case 'linux':
                        formats.push('.png');
                        if (icoToPng) {
                          formats.push('.ico');
                        }
                  Severity: Major
                  Found in src/helpers/helpers.js and 2 other locations - About 50 mins to fix
                  src/helpers/helpers.js on lines 67..75
                  src/helpers/helpers.js on lines 85..93

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Function createTrayIcon has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function createTrayIcon(inpOptions, mainWindow) {
                    const options = Object.assign({}, inpOptions);
                  
                    if (options.tray) {
                      const iconPath = getAppIcon();
                  Severity: Minor
                  Found in app/src/components/trayIcon/trayIcon.js - About 45 mins 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

                  Avoid too many return statements within this function.
                  Open

                      return;
                  Severity: Major
                  Found in src/build/iconBuild.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language