Showing 10 of 12 total issues
Function listenForLogs
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
listenForLogs () {
const send = this.send.bind(this, 'logs')
let isTemporalyLogging = false // used for startLogging and stopLogging
// Listen actions
Function listenForLogs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
listenForLogs () {
const send = this.send.bind(this, 'logs')
let isTemporalyLogging = false // used for startLogging and stopLogging
// Listen actions
- Read upRead up
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 connect
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
connect (cb) {
debug('Connect transporter to websocket server')
try {
this.ws = new WebSocket(this.endpoint, {
Function open
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
static open (opts, cb) {
const http = this.getModule(opts.url)
const parsedUrl = url.parse(opts.url)
let data = null
const options = {
Function start
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
start () {
return new Promise((resolve, reject) => {
if (this.isStopping) return reject(new Error('Agent is stopping'))
// Trying to check infos
Function constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (config, proc) {
// Valid config
if (!config ||
typeof config.publicKey !== 'string' ||
typeof config.secretKey !== 'string' ||
Consider simplifying this complex logical expression. Open
if (!config ||
typeof config.publicKey !== 'string' ||
typeof config.secretKey !== 'string' ||
typeof config.appName !== 'string' ||
(typeof config.proxy !== 'undefined' && typeof config.proxy !== 'string') ||
Function constructor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
constructor (config, proc) {
// Valid config
if (!config ||
typeof config.publicKey !== 'string' ||
typeof config.secretKey !== 'string' ||
- Read upRead up
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 cb(null, data.endpoints)
Function send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
send (packet) {
if (!packet.channel || !packet.payload) return false
if (!this.isConnected()) {
this.bufferPacket(packet)
return false
- Read upRead up
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"