lsm/micromono

View on GitHub

Showing 91 of 91 total issues

Function checkRemoteServicesAvailability has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.checkRemoteServicesAvailability = function(services, discoveryOptions) {
  var minInterval = 3000
  var remoteServices = []

  Object.keys(services).forEach(function(serviceName) {
Severity: Minor
Found in lib/service/remote.js - About 1 hr to fix

    Function getProxyHandler has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.getProxyHandler = function(scheduler, httpServer, upgradeUrl) {
      var proxy = httpProxy.createProxyServer({})
    
      if (httpServer && upgradeUrl) {
        var re = new RegExp('^' + upgradeUrl)
    Severity: Minor
    Found in lib/web/router.js - About 1 hr to fix

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

      secondChannel.sub('server:message', function(msg) {
        msg = '<b>/channel/b: </b>' + new Date() + ' message from server: <br />' + msg
        var el = document.getElementById('message')
        el.innerHTML += msg + '<br /><br />'
      })
      Severity: Major
      Found in example/channel/public/main.js and 1 other location - About 1 hr to fix
      example/channel/public/main.js on lines 10..14

      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

      firstChannel.sub('server:message', function(msg) {
        msg = '<b>/channel/a: </b>' + new Date() + ' message from server: <br />' + msg
        var el = document.getElementById('message')
        el.innerHTML += msg + '<br /><br />'
      })
      Severity: Major
      Found in example/channel/public/main.js and 1 other location - About 1 hr to fix
      example/channel/public/main.js on lines 33..37

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

      exports.startBalancer = function(micromono, app, callback) {
        var packagePath = ServerPipe.getCallerPath()
        logger.info('Start balancer pipeline').debug({
          packagePath: packagePath
        })
      Severity: Minor
      Found in lib/entrance/balancer.js - About 1 hr to fix

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

        exports.startService = function(micromono, Service, callback, cbDependencies) {
          logger.info('Start service pipeline')
          // Get instance of service.
          var service = 'function' === typeof Service ? new Service() : Service
          // Prepare global service dependencies
        Severity: Minor
        Found in lib/entrance/service.js - About 1 hr to fix

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

          exports.prepareBundleInfo = function(assetInfo, publicPath, bundleOptions) {
            // Prepare bundleOptions for jspm/systemjs builder
            bundleOptions.name = assetInfo.name
            bundleOptions = getDefaultBundleOptions(bundleOptions)
          
          
          Severity: Minor
          Found in lib/web/asset/bundle.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

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

              "npm:socket.io-client@1.4.8": {
                "backo2": "npm:backo2@1.0.2",
                "buffer": "github:jspm/nodelibs-buffer@0.1.0",
                "component-bind": "npm:component-bind@1.0.0",
                "component-emitter": "npm:component-emitter@1.2.0",
          Severity: Major
          Found in example/io/public/config.js and 1 other location - About 1 hr to fix
          example/balancer/public/config.js on lines 216..229

          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 66.

          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

              "npm:socket.io-client@1.4.5": {
                "backo2": "npm:backo2@1.0.2",
                "buffer": "github:jspm/nodelibs-buffer@0.1.0",
                "component-bind": "npm:component-bind@1.0.0",
                "component-emitter": "npm:component-emitter@1.2.0",
          Severity: Major
          Found in example/balancer/public/config.js and 1 other location - About 1 hr to fix
          example/io/public/config.js on lines 125..138

          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 66.

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

          exports.ensureChannelGateway = function(services, set) {
            logger.debug('ensureChannelGateway')
          
            var chnGateway
            var hasServiceWithChannel = Object.keys(services).some(function(name) {
          Severity: Minor
          Found in lib/channel/gateway.js - About 1 hr to fix

            Function getCommonBundles has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.getCommonBundles = function(assetInfo, servicesWithAsset, assetDependenciesMap) {
              var numServices = servicesWithAsset.length
              // Any dependency required by 70% or more of the services
              // Minus any dependencies in assetInfo.micromono.bundleDeps
              // (which will be bundled with the main bundle.)
            Severity: Minor
            Found in lib/web/asset/pjson.js - About 1 hr to fix

              Function bundle has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.bundle = function(assetInfo, packagePath, jspmBinPath, bundleCmd, bundleOptions, set) {
                var publicURL = assetInfo.publicURL[0]
                jspm.runJSPM(packagePath, jspmBinPath, bundleCmd.split(' '), function(err) {
                  if (err)
                    return set('error', err)
              Severity: Minor
              Found in lib/web/asset/bundle.js - About 1 hr to fix

                Function generateAnnouncement has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.generateAnnouncement = function(service, serviceInfo, host, web, api, channel) {
                  var ann = new Announcement(service)
                  ann.host = host
                  if (web.asset)
                    ann.asset = web.asset
                Severity: Minor
                Found in lib/service/local.js - About 1 hr to fix

                  Function prepareBundleInfo has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.prepareBundleInfo = function(assetInfo, publicPath, bundleOptions) {
                    // Prepare bundleOptions for jspm/systemjs builder
                    bundleOptions.name = assetInfo.name
                    bundleOptions = getDefaultBundleOptions(bundleOptions)
                  
                  
                  Severity: Minor
                  Found in lib/web/asset/bundle.js - About 1 hr to fix

                    Function normalizeRoutes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.normalizeRoutes = function(route, page, pageApiBaseUrl) {
                      var _routes = {}
                    
                      Object.keys(route).forEach(function(routePath) {
                        var middleware
                    Severity: Minor
                    Found in lib/web/router.js - About 1 hr to fix

                      Function getDefaultBundleOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function getDefaultBundleOptions(opts, env) {
                        opts = opts || {}
                        var _opts = {
                          bundleDeps: false,
                          outFile: 'bundle' + (opts.name ? '-' + opts.name : '') + '.js',
                      Severity: Minor
                      Found in lib/web/asset/bundle.js - About 1 hr to fix

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

                            "npm:engine.io-client@1.6.8": {
                              "buffer": "github:jspm/nodelibs-buffer@0.1.0",
                              "component-emitter": "npm:component-emitter@1.1.2",
                              "component-inherit": "npm:component-inherit@0.0.3",
                              "debug": "npm:debug@2.2.0",
                        Severity: Major
                        Found in example/balancer/public/config.js and 3 other locations - About 1 hr to fix
                        example/balancer/public/config.js on lines 107..119
                        example/channel/public/config.js on lines 87..99
                        example/io/public/config.js on lines 73..85

                        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 61.

                        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 4 locations. Consider refactoring.
                        Open

                            "npm:engine.io-client@1.6.11": {
                              "buffer": "github:jspm/nodelibs-buffer@0.1.0",
                              "component-emitter": "npm:component-emitter@1.1.2",
                              "component-inherit": "npm:component-inherit@0.0.3",
                              "debug": "npm:debug@2.2.0",
                        Severity: Major
                        Found in example/io/public/config.js and 3 other locations - About 1 hr to fix
                        example/balancer/public/config.js on lines 107..119
                        example/balancer/public/config.js on lines 138..150
                        example/channel/public/config.js on lines 87..99

                        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 61.

                        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 4 locations. Consider refactoring.
                        Open

                            "npm:clean-css@3.1.9": {
                              "buffer": "github:jspm/nodelibs-buffer@0.1.0",
                              "commander": "npm:commander@2.6.0",
                              "fs": "github:jspm/nodelibs-fs@0.1.2",
                              "http": "github:jspm/nodelibs-http@1.7.1",
                        Severity: Major
                        Found in example/balancer/public/config.js and 3 other locations - About 1 hr to fix
                        example/balancer/public/config.js on lines 138..150
                        example/channel/public/config.js on lines 87..99
                        example/io/public/config.js on lines 73..85

                        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 61.

                        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 4 locations. Consider refactoring.
                        Open

                            "npm:engine.io-client@1.6.11": {
                              "buffer": "github:jspm/nodelibs-buffer@0.1.0",
                              "component-emitter": "npm:component-emitter@1.1.2",
                              "component-inherit": "npm:component-inherit@0.0.3",
                              "debug": "npm:debug@2.2.0",
                        Severity: Major
                        Found in example/channel/public/config.js and 3 other locations - About 1 hr to fix
                        example/balancer/public/config.js on lines 107..119
                        example/balancer/public/config.js on lines 138..150
                        example/io/public/config.js on lines 73..85

                        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 61.

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language