Showing 31 of 37 total issues
Function findPQ
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
PQFinder.prototype.findPQ = function () {
if (!this._pq) {
var num = this._pqNumber;
var prime;
for (var i = 0; i < 3; i++) {
- 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 setClientDHParams
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function setClientDHParams(callback, context) {
mtproto.service.set_client_DH_params({
props: {
nonce: context.resPQ.nonce,
server_nonce: context.resPQ.server_nonce,
- 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 parse
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
MessageParser.prototype.parse = function (message, duration) {
if(!message || !message.getTypeName) {
logger.error('Message undefined or unknown', message);
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 requestDHParams
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function requestDHParams(callback, context) {
var resPQ = context.resPQ;
mtproto.service.req_DH_params({
props: {
nonce: resPQ.nonce,
- 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 callMethod
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
EncryptedRpcChannel.prototype.callMethod = function (method, callback) {
if (!this._open) {
callback(new Error('Channel is closed'));
return;
}
Function findPQ
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
PQFinder.prototype.findPQ = function () {
if (!this._pq) {
var num = this._pqNumber;
var prime;
for (var i = 0; i < 3; i++) {
Function read
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
TcpConnection.prototype.read = function (callback) {
var self = this;
var buffers = [];
var timer;
if (logger.isDebugEnabled()) {
Function _executeCall
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
RpcChannel.prototype._executeCall = function (reqMsg, callback) {
var conn = this._connection;
var start = new Date().getTime();
var self = this;
conn.write(reqMsg.serialize(), function (ex) {
Function connect
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
TcpConnection.prototype.connect = function (callback) {
var self = this;
if (logger.isDebugEnabled()) {
logger.debug('Connecting to %s', self._config);
}
Function close
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
TcpConnection.prototype.close = function (callback) {
var self = this;
var socket = this._socket;
if (socket) {
if (logger.isDebugEnabled()) {
- 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 EncryptedMessage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function EncryptedMessage(options) {
var opts = options ? options : {};
this.constructor.super_.call(this, opts.buffer, opts.offset);
this.authKey = opts.authKey;
if (opts.message) {
- 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 callMethod
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
EncryptedRpcChannel.prototype.callMethod = function (method, callback) {
if (!this._open) {
callback(new Error('Channel is closed'));
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 setClientDHParams
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setClientDHParams(callback, context) {
mtproto.service.set_client_DH_params({
props: {
nonce: context.resPQ.nonce,
server_nonce: context.resPQ.server_nonce,
Function write
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
TcpConnection.prototype.write = function (data, callback) {
var self = this;
var socket = this._socket;
if (!socket && callback) {
callback(createError('Not yet connected', 'ENOTCONNECTED'));
Function requestDHParams
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function requestDHParams(callback, context) {
var resPQ = context.resPQ;
mtproto.service.req_DH_params({
props: {
nonce: resPQ.nonce,
Function _createRequest
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
HttpConnection.prototype._createRequest = function (options, callback) {
var request = http.request(options, function (res) {
if (logger.isDebugEnabled()) {
logger.debug('reading from %s\nstatus: %s\nheaders: %s',
this._config, res.statusCode, JSON.stringify(res.headers));
Function parse
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
MessageParser.prototype.parse = function (message, duration) {
if(!message || !message.getTypeName) {
logger.error('Message undefined or unknown', message);
return;
}
Function _call
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
EncryptedRpcChannel.prototype._call = function (reqMsg, directCallback) {
var self = this;
var callback = directCallback || this._callbackMap[reqMsg.messageId];
try {
this.constructor.super_.prototype._call.call(this, reqMsg, function (ex, result, duration) {
Function callback
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
callback: function (ex, setClientDHParamsAnswer) {
if (ex) {
logger.error(ex);
if (callback) {
callback(ex);
Function close
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
TcpConnection.prototype.close = function (callback) {
var self = this;
var socket = this._socket;
if (socket) {
if (logger.isDebugEnabled()) {