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
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) {
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)
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', {
Similar blocks of code found in 2 locations. Consider refactoring. Open
micromono
.set(Router, '*^')
.set(AssetPipe, '*^')
.set(LocalPipe, '*^')
.set(HealthPipe, '*^')
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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'])
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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'])
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
micromono
.set(AssetPipe, '*^')
.set(LocalPipe, '*^')
.set(HealthPipe, '*^')
.set(RemotePipe, '*^')
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
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
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 {
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', {
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)
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()
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
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
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)
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
})
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]
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) {