lsm/micromono

View on GitHub

Showing 91 of 91 total issues

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

exports.getAssetInfo = function(packagePath, packageJSON, serviceName) {
  serviceName = serviceName || ''

  var assetInfo
  var publicURL
Severity: Minor
Found in lib/web/asset/pjson.js - About 1 hr to fix

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

      function checkAvailability() {
        var now = Date.now()
        remoteServices.forEach(function(service) {
          var scheduler = service.scheduler
          scheduler.each(function(ann) {
    Severity: Minor
    Found in lib/service/remote.js - About 1 hr to fix

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

      exports.buildServiceFromAnnouncement = function(ann) {
        logger.info('Build remote service from announcement', {
          service: ann.name,
          version: ann.version
        }).trace(ann)
      Severity: Minor
      Found in lib/service/remote.js - About 1 hr to fix

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

        exports.listen = function(options, callback) {
          var port = options.MICROMONO_DISCOVERY_UDP_PORT || PORT
          var address = options.MICROMONO_DISCOVERY_UDP_ADDRESS || ADDRESS
        
          logger.info('Listening service annoucements using udp multicast', {
        Severity: Minor
        Found in lib/discovery/udp.js - About 1 hr to fix

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

            micromono
              .set(Router, '*^')
              .set(AssetPipe, '*^')
              .set(LocalPipe, '*^')
              .set(HealthPipe, '*^')
          Severity: Major
          Found in lib/entrance/balancer.js and 1 other location - About 1 hr to fix
          lib/entrance/service.js on lines 27..34

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

          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

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

            var chnJoinHook = Superpipe.pipeline()
              .pipe(prepareChnPipeline, 3, ['chn', 'meta', 'event', 'parentNext'])
              .pipe(channel.auth, ['meta', 'next'], ['session', 'ssn'])
              .pipe(requireSession, ['session', 'next'])
              .pipe(channel.join, ['session', 'chn', 'next'], ['repEvents', 'subEvents'])
          Severity: Major
          Found in lib/channel/backend.js and 1 other location - About 1 hr to fix
          lib/channel/backend.js on lines 239..243

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

          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

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

            var chnAllowHook = Superpipe.pipeline()
              .pipe(prepareChnPipeline, 3, ['chn', 'meta', 'event', 'parentNext'])
              .pipe(channel.auth, ['meta', 'next'], ['session', 'ssn'])
              .pipe(requireSession, ['session', 'next'])
              .pipe(channel.allow, ['session', 'chn', 'event', 'next'])
          Severity: Major
          Found in lib/channel/backend.js and 1 other location - About 1 hr to fix
          lib/channel/backend.js on lines 220..224

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

          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

            micromono
              .set(AssetPipe, '*^')
              .set(LocalPipe, '*^')
              .set(HealthPipe, '*^')
              .set(RemotePipe, '*^')
          Severity: Major
          Found in lib/entrance/service.js and 1 other location - About 1 hr to fix
          lib/entrance/balancer.js on lines 31..38

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

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

          ExpressAdapter.prototype.useMiddleware = function(url, middleware, routes, service) {
            if (!Array.isArray(url))
              url = [url]
          
            var app = this.app
          Severity: Minor
          Found in lib/web/framework/express.js - About 1 hr to fix

            Function getJSPMConfig has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.getJSPMConfig = function(assetInfo, publicPath, next) {
              var configPath = path.join(publicPath, 'config.js')
            
              logger.debug('getJSPMConfig', {
                configPath: configPath
            Severity: Minor
            Found in lib/web/asset/jspm.js - About 1 hr to fix

              Function localRequire has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.localRequire = function(serviceName, serviceDir, services) {
                var ServiceClass
                var servicePath = serviceName
              
                try {
              Severity: Minor
              Found in lib/discovery/index.js - About 1 hr to fix

                Function announce has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.announce = function(data, options, interval) {
                  options = assign({}, NATS_DEFAULT_OPTIONS, options)
                  interval = interval || options.MICROMONO_DISCOVERY_ANNOUNCE_INTERVAL || 3000
                
                  logger.info('Announcing service using nats pubsub', {
                Severity: Minor
                Found in lib/discovery/nats.js - About 1 hr to fix

                  Function createChannelAdapters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.createChannelAdapters = function(channels, service) {
                    logger.debug('createChannelAdapters', {
                      service: service.name
                    }).trace(channels)
                  
                  
                  Severity: Minor
                  Found in lib/channel/backend.js - About 1 hr to fix

                    Function setDefaultChannelHandlers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.setDefaultChannelHandlers = function(channel) {
                      if (!channel.auth) {
                        logger.warn('Please define `auth` property in channel to set your own auth handler function. All requests will be allowed by default.')
                        channel.auth = function(session, next) {
                          next()
                    Severity: Minor
                    Found in lib/channel/backend.js - About 1 hr to fix

                      Function mergeAssetDependencies has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.mergeAssetDependencies = function(dstAssetInfo, srcAssetInfo) {
                        var assetDependenciesChanged = undefined
                      
                        if (srcAssetInfo.dependencies) {
                          var srcDeps = srcAssetInfo.dependencies
                      Severity: Minor
                      Found in lib/web/asset/pjson.js - About 1 hr to fix

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

                        SocketMQAdapter.prototype.connect = function(provider) {
                          var self = this
                          var adapter = this.adapter
                          var name = provider.name
                          var endpoint = 'tcp://' + provider.host + ':' + provider.api.port
                        Severity: Minor
                        Found in lib/api/socketmq.js - About 1 hr to fix

                          Function MicromonoRPC has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var RPC = module.exports = function MicromonoRPC(options) {
                            logger.info('Initialize MicromonoRPC', {
                              type: options.type,
                              isRemote: options.isRemote
                            }).trace(options)
                          Severity: Minor
                          Found in lib/api/rpc.js - About 1 hr to fix

                            Function startChnBackendServer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            exports.startChnBackendServer = function(channels, chnBackend, chnEndpoint, next) {
                              logger.debug('startChnBackendServer').trace({
                                chnEndpoint: chnEndpoint,
                                channels
                              })
                            Severity: Minor
                            Found in lib/channel/backend.js - About 1 hr to fix

                              Function attachRoutes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              ExpressAdapter.prototype.attachRoutes = function(routes, service) {
                                var app = this.app
                              
                                Object.keys(routes).forEach(function(routeName) {
                                  var route = routes[routeName]
                              Severity: Minor
                              Found in lib/web/framework/express.js - About 1 hr to fix

                                Function attachChannelHooks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                exports.attachChannelHooks = function(chnAdapter, channel, chnJoinHook, chnAllowHook) {
                                  logger.debug('attachChannelHooks').trace(channel)
                                
                                  var allowHook = function(pack, stream, dispatch) {
                                    if (REQ === pack.type) {
                                Severity: Minor
                                Found in lib/channel/backend.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language