Showing 41 of 78 total issues
Function consumeFrame
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
Stream.prototype.consumeFrame = function (frame) {
this.stat.received += frame.getBuffer().length;
this.emit('frame', frame);
if (frame.streamId > 0) {
switch (this.state) {
- 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 consumeFrame
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Stream.prototype.consumeFrame = function (frame) {
this.stat.received += frame.getBuffer().length;
this.emit('frame', frame);
if (frame.streamId > 0) {
switch (this.state) {
Function exec
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
'exec': function (args, callback) {
if (!args[1]) {
console.log('usage: get URL');
console.log('');
console.log('You can specify authority by using format below.');
- 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 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Stream.prototype.send = function (frames, callback) {
if (!(frames instanceof Array)) {
frames = [frames];
}
var self = this;
Function printFrame
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
module.exports.printFrame = function (frame, verbose) {
var str = frame.toString();
if (verbose) {
var flags = [];
- 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 printFrame
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.printFrame = function (frame, verbose) {
var str = frame.toString();
if (verbose) {
var flags = [];
Function Connection
has 78 lines of code (exceeds 25 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;
File h2.js
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
var util = require('util');
var events = require('events');
var h2connection = require('./connection');
var h2frame = require('./frame');
var h2util = require('./util');
Function exec
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
'exec': function (args, callback) {
if (!args[1]) {
console.log('usage: get URL');
console.log('');
console.log('You can specify authority by using format below.');
Function exec
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
'exec': function (args, callback) {
if (!args[1]) {
console.log('usage: head URL');
console.log('');
console.log('You can specify authority by using format below.');
- 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 request
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
H2.prototype.request = function (/* authority, path, method, data, callbacks */) {
var self = this, authority, path, method, data, callbacks, pos, i, f;
pos = 0;
if (arguments[0][0] === '/') {
authority = self.connection ? self.connection.hostname : '';
- 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 request
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
H2.prototype.request = function (/* authority, path, method, data, callbacks */) {
var self = this, authority, path, method, data, callbacks, pos, i, f;
pos = 0;
if (arguments[0][0] === '/') {
authority = self.connection ? self.connection.hostname : '';
Function connect
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
H2.prototype.connect = function (hostname, port, options, callback) {
var self = this;
if (!options.secure && typeof options.useUpgrade === 'undefined') {
options.useUpgrade = self.config['http2.use_upgrade'];
}
Function exec
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
'exec': function (args, callback) {
if (!args[1]) {
console.log('usage: head URL');
console.log('');
console.log('You can specify authority by using format below.');
Function exec
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
'exec': function (args, callback) {
switch (args[1]) {
case 'settings':
if (this.client.connection) {
console.log('NAME | Local | Remote');
Function exec
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
'exec': function (args, callback) {
if (!args[1]) {
console.log('usage: post URL data');
console.log('');
console.log('You can specify authority by using format below.');
Function exec
has 49 lines of code (exceeds 25 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/';
Function createCompleter
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
module.exports.createCompleter = function (hints) {
return function (line) {
var args = line.split(' ');
var i, candidates, hits;
candidates = hints;
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
'exec': function (args, callback) {
if (!args[1]) {
console.log('usage: post URL data');
console.log('');
console.log('You can specify authority by using format below.');
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
var Http2HeadersFrame = module.exports = function (buf) {
if (!(this instanceof Http2HeadersFrame)) {
return new Http2HeadersFrame(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"