Showing 41 of 78 total issues
Function newStream
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Connection.prototype.newStream = function (id) {
if (typeof id !== 'undefined') {
if (id % 2 === 1) {
if (id > this.highestStreamId) {
this.highestStreamId = id;
- 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 handleSettingsFrame
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
var handleSettingsFrame = function (stream, frame) {
var p, i, params, nParam, ackFrame;
if (frame.flags & h2frame.Http2SettingsFrame.FLAG_ACK) {
params = this._settingQueue.shift();
if (params) {
- 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 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
'exec': function (args, callback) {
var frame;
switch (args[1]) {
case 'preface':
this.client.send(h2.HTTP2_PREFACE, callback);
Function _read
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Http2Reader.prototype._read = function(n) {
var chunk = this._source.read();
if (chunk === null) {
return this.push('');
}
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
'exec': function (args, callback) {
switch (args[1]) {
case 'settings':
if (this.client.connection) {
console.log('NAME | Local | Remote');
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Http2Reader.prototype._read = function(n) {
var chunk = this._source.read();
if (chunk === null) {
return this.push('');
}
Function createFieldGetter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var createFieldGetter = function (definition) {
switch (definition.type) {
case 'UINT':
if (definition.bitLength % 8 === 0) {
return function () {
Function createCompleter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.createCompleter = function (hints) {
return function (line) {
var args = line.split(' ');
var i, candidates, hits;
candidates = hints;
Function getCompletions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getCompletions = function (line) {
var args = line.split(' ', 2);
if (args.length === 1) {
var hits = Object.keys(cmdTable).filter(function(c) { return c.indexOf(args[0]) === 0; });
if (hits.length === 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 9 (exceeds 5 allowed). Consider refactoring. Open
'exec': function (args, callback) {
if (!args[1]) {
args[1] = 'http://localhost:8080/';
//args[1] = 'https://nghttp2.org/';
//args[1] = 'http://nghttp2.org/';
- 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 deeply nested control flow statements. Open
if (paramStr) {
params.push(' ' + paramStr + ': ' + param.value);
} else {
params.push(' ' + param.id + ': ' + param.value);
}
Function createFieldSetter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var createFieldSetter = function (definition) {
switch (definition.type) {
case 'UINT':
if (definition.bitLength % 8 === 0) {
return function (value) {
- 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 (args, callback) {
if (this.client) {
this.client.close(function () {
console.log('Connection closed.');
if (callback) {
- 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 cmdTable[args[0]].getCompletions(line);
Avoid too many return
statements within this function. Open
return [[], line];
Function exec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
'exec': function (args, callback) {
var frame;
switch (args[1]) {
case 'preface':
this.client.send(h2.HTTP2_PREFACE, callback);
- 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 send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
H2.prototype.send = function (frame, streamId, callback) {
if (!this.connection) {
console.error('Not connected yet.');
arguments[arguments.length - 1]();
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 send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
"send": (s, resolve, reject) => {
try {
if (s.type === "preface") {
process.stdout.write("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n", 'ascii');
} else if (s.type === "raw") {
- 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 Connection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var Connection = module.exports.Connection = function (hostname, port, options) {
var self = this;
this.hostname = hostname;
this.port = port;
this.secure = options.secure;
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var Http2PushPromiseFrame = module.exports = function (buf) {
if (!(this instanceof Http2PushPromiseFrame)) {
return new Http2PushPromiseFrame(buf);
}
if (buf) {
- 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"