Showing 18 of 147 total issues
Function flags
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
DataJunk.prototype.flags = function (col, dt, res, ts) {
for (let c in col.sets) {
if (col.sets.hasOwnProperty('a')) {
for (let d in col.sets[c]) {
if (col.sets[c][d]) {
- 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
Consider simplifying this complex logical expression. Open
if (!req.body.name || !req.body.name.length ||
!req.body.sourcegenre || !req.body.sourcetype ||
!req.body.sourcename || !req.body.sourcereqpath ||
!(req.session && req.session.userId)) {
let err = new Error('All fields required.');
Function getparsed
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getparsed: function (dset, ts) {
let rt = [];
for (let el in dset) {
if (dset[el]) {
for (let k in dset[el].feed) {
- 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 eat
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
DataJunk.prototype.eat = function (dset) {
let ts = {
nb: 0,
val: 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 addsource
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
ScrapperSchemas.statics.addsource = (uinput, callback) => {
let Sources = mongoose.model('Sources', SourcesSchema);
let whatsource = 'Sources.' + uinput.sourcegenre + '.' + uinput.sourcetype;
let newsource = {
name: uinput.sourcename,
Function setpagecontent
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setpagecontent (req, pageparam, dbr) {
return new Promise((resolve, reject) => {
let res = {};
for (let paths in roads) {
if (roads.hasOwnProperty(paths) && req.match(roads[paths].path)) {
Function startmeup
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
CbWebsocket.prototype.startmeup = function () {
let log = 'WEBSOCKET - server is listening on :\n';
log += 'addr: [' + this.conf.myip + '], port ' + this.port;
let _this = this;
Function res
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
res: function (el) {
for (let x in this.bull.sets) {
if (this.bull.sets[x]) {
for (let y in this.bull.sets.x) {
if (el.match(this.bull.sets.x[y])) {
- 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 exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
basePath: '../',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
Function fields
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
fields: function () {
return {
username: {
type: graphql.GraphQLString,
},
Function getsums
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
N26Api.prototype.getsums = function (tr, key) {
let sum = 0;
let min = 0;
let plus = 0;
let res = {
- 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 addapi
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
UserSchema.statics.addapi = function (id,
apitype, apiid, apikey, apisecret, callback) {
Avoid deeply nested control flow statements. Open
if (d.feed && d.dm) {
res.locals.news = d.feed;
res.locals.dms = d.dm;
}
Avoid deeply nested control flow statements. Open
if (col.check(obj)) {
res[ts.val] = this.eatd.getres(obj, ts);
}
Avoid deeply nested control flow statements. Open
if (d.blocks) {
res.locals.routes = d.blocks;
}
Function runcommands
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
CbBot.prototype.runcommands = function (cmd, ctx, who) {
let _this = this;
let exec = 0;
for (let el in this.cmds) {
if (this.cmds.hasOwnProperty(el) &&
- 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
Consider simplifying this complex logical expression. Open
if (req.body.apitype && req.body.apiid && req.body.apikey &&
req.body.apisecret && req.session && req.session.userId) {
let dup = param.assets;
User.addapi(req.session.userId, req.body.apitype,
req.body.apiid, req.body.apikey, req.body.apisecret,
Consider simplifying this complex logical expression. Open
if (req.body.assettype && req.body.assetid && req.body.assetticker &&
req.body.assetqtt && req.session && req.session.userId) {
let dup = param.assets;
User.addasset(req.session.userId, req.body.assettype,
req.body.assetid, req.body.assetticker, req.body.assetqtt,