Showing 17 of 17 total issues
Function exec
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exec: async function (transcripts) {
try {
for (let name in commands) {
let command = commands[name]
if (!command.func) return
- 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 _transform
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_transform(chunk, encoding, callback) {
// return callback(null, chunk)
this.retry = null
const sampleAvailable = Math.min(this.input ? this.input.availSamples() : Number.MAX_VALUE, chunk.length / this.sampleByteLength)
if (this.input && sampleAvailable > 0) {
- 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 init
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: stumble => {
const player = stumble.space.get('youtube-player')
player.on('play', v => stumble.execute("youtube::info::playing", v))
player.on('add', v => stumble.execute("youtube::info::added", v))
player.on('addnext', v => stumble.execute("youtube::info::next", v))
Function exec
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec: async function (data) {
try {
const links = utils.getLinks(data.message)
const givenId = parse(links.length > 0 ? links[0] : data.message)
const isId = /^UC[a-zA-Z0-9_-]{1,}$/.test(givenId)
Function exec
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec: function (data) {
const stumble = this
const links = utils.getLinks(data.message)
let link = ""
if (links.length < 1) {
Function exec
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exec: function (data) {
const stumble = this
const links = utils.getLinks(data.message)
let link = ""
if (links.length < 1) {
- 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 init
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: async stumble => {
return new Error('Not implemented')
try {
const phone = new sylvia()
stumble.space.set('phone', phone)
Function main
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function main() {
s.client.connection.on('error', e => {
logger.error(e)
logger.log(e.data)
})
Function info
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exec: function info(data) {
const name = data.message || 'info';
const aliased = data.message && this.aliases.get(name);
const target = this.commands.get(aliased || name);
- 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 _read
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_read() {
this.retry = null
let samples = Number.MAX_VALUE
const keys = Object.keys(this.inputs)
const keyslenth = keys.length
- 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 _write
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_write(chunk, encoding, cb) {
clearTimeout(this.timeout)
if (this.pending) {
this.acc.push(chunk)
} else {
- 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 convertISO8601ToObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function convertISO8601ToObject(input) {
var reptms = /^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/
var hours = 0,
minutes = 0,
seconds = 0,
- 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 exec
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exec: function ({ filename, user }) {
const file = path.resolve(this.config.extensions.voice.folder, filename)
const player = this.space.get('player')
if (!player.playing) {
- 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 convertISO8601ToSring
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function convertISO8601ToSring(input) {
const dur = convertISO8601ToObject(input)
let str = ""
if (dur.hours > 0) {
if (str.length > 0 && dur.hours < 10) str += "0"
- 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 exec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exec: async function (data) {
try {
const links = utils.getLinks(data.message)
const givenId = parse(links.length > 0 ? links[0] : data.message)
const isId = /^UC[a-zA-Z0-9_-]{1,}$/.test(givenId)
- 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
Unreachable code. Open
try {
- Read upRead up
- Exclude checks
disallow unreachable code after return
, throw
, continue
, and break
statements (no-unreachable)
Because the return
, throw
, break
, and continue
statements unconditionally exit a block of code, any statements after them cannot be executed. Unreachable statements are usually a mistake.
function fn() {
x = 1;
return x;
x = 3; // this will never execute
}
Rule Details
This rule disallows unreachable code after return
, throw
, continue
, and break
statements.
Examples of incorrect code for this rule:
/*eslint no-unreachable: "error"*/
function foo() {
return true;
console.log("done");
}
function bar() {
throw new Error("Oops!");
console.log("done");
}
while(value) {
break;
console.log("done");
}
throw new Error("Oops!");
console.log("done");
function baz() {
if (Math.random() < 0.5) {
return;
} else {
throw new Error();
}
console.log("done");
}
for (;;) {}
console.log("done");
Examples of correct code for this rule, because of JavaScript function and variable hoisting:
/*eslint no-unreachable: "error"*/
function foo() {
return bar();
function bar() {
return 1;
}
}
function bar() {
return x;
var x;
}
switch (foo) {
case 1:
break;
var x;
}
Source: http://eslint.org/docs/rules/
TODO found Open
// TODO: second request getById on comma separated id list to get duration and other stats
- Exclude checks