meteor/meteor

View on GitHub
tools/cordova/builder.js

Summary

Maintainability
F
3 days
Test Coverage

File builder.js has 537 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'underscore';
import url from 'url';
import { Console } from '../console/console.js';
import buildmessage from '../utils/buildmessage.js';
import files from '../fs/files';
Severity: Major
Found in tools/cordova/builder.js - About 1 day to fix

    Function initalizeDefaults has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      initalizeDefaults() {
        let { cordovaServerPort } = this.options;
        // if --cordova-server-port is not present on run command
        if (!cordovaServerPort) {
          cordovaServerPort = CordovaBuilder.createCordovaServerPort(
    Severity: Major
    Found in tools/cordova/builder.js - About 3 hrs to fix

      Function writeConfigXmlAndCopyResources has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        writeConfigXmlAndCopyResources(shouldCopyResources = true) {
          let config = XmlBuilder.create({ version: '1.0' }).ele('widget');
      
          // Set the root attributes
          _.each({
      Severity: Major
      Found in tools/cordova/builder.js - About 3 hrs to fix

        Function createAppConfiguration has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createAppConfiguration(builder) {
          const { settingsFile } = builder.options;
          let settings = null;
          if (settingsFile) {
            settings = optimisticReadJsonOrNull(settingsFile);
        Severity: Major
        Found in tools/cordova/builder.js - About 3 hrs to fix

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

            initalizeDefaults() {
              let { cordovaServerPort } = this.options;
              // if --cordova-server-port is not present on run command
              if (!cordovaServerPort) {
                cordovaServerPort = CordovaBuilder.createCordovaServerPort(
          Severity: Minor
          Found in tools/cordova/builder.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 createAppConfiguration has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          function createAppConfiguration(builder) {
            const { settingsFile } = builder.options;
            let settings = null;
            if (settingsFile) {
              settings = optimisticReadJsonOrNull(settingsFile);
          Severity: Minor
          Found in tools/cordova/builder.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 _configureAndCopySplashImages has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _configureAndCopySplashImages(allowedValues, xmlElement, isIos = false) {
              const appendDarkMode = (stringValue , { separator = '.', withChar = '~' } = {}) => {
                if (!stringValue) {
                  throw new Error("No string was passed.");
                }
          Severity: Minor
          Found in tools/cordova/builder.js - About 1 hr to fix

            Function generateBootstrapPage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              generateBootstrapPage(applicationPath, program, publicSettings) {
                const meteorRelease =
                  release.current.isCheckout() ? "none" : release.current.name;
                const hmrVersion =
                  this.options.buildMode === 'development' ? Date.now() : undefined
            Severity: Minor
            Found in tools/cordova/builder.js - About 1 hr to fix

              Function _configureAndCopySplashImages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                _configureAndCopySplashImages(allowedValues, xmlElement, isIos = false) {
                  const appendDarkMode = (stringValue , { separator = '.', withChar = '~' } = {}) => {
                    if (!stringValue) {
                      throw new Error("No string was passed.");
                    }
              Severity: Minor
              Found in tools/cordova/builder.js - About 25 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

              There are no issues that match your filters.

              Category
              Status