Showing 35 of 104 total issues
Function init
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
GroupConsumer.prototype.init = function (strategies) {
var self = this;
return BaseConsumer.prototype.init.call(self).then(function () {
if (_.isEmpty(strategies)) {
Function assignment
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
ConsistentAssignmentStrategy.prototype.assignment = function (subscriptions) { // [{topic:String, members:[], partitions:[]}]
var result = [];
_.each(subscriptions, function (sub) {
var members = {}, ring;
Function _updateSubscriptions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
GroupConsumer.prototype._updateSubscriptions = function (partitionAssignment) {
var self = this, offsetRequests = [],
handler = self.strategies[self.strategyName].handler;
self.subscriptions = {};
Function fetchConsumerLag
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
GroupAdmin.prototype.fetchConsumerLag = function (groupId, offsetFetchRequestArgs) {
return Promise.all([
this.client.offsetFetchRequestV1(groupId, offsetFetchRequestArgs),
this._fetchHighWaterMark(offsetFetchRequestArgs)
]).spread(function (offsets, highWaterMark) {
Function _findGroupCoordinator
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Client.prototype._findGroupCoordinator = function (groupId) {
var self = this, buffer, correlationId = self.nextCorrelationId();
if (self.groupCoordinators[groupId] && !self.groupCoordinators[groupId].isRejected()) {
return self.groupCoordinators[groupId];
Function connect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Connection.prototype.connect = function () {
var self = this;
if (self.connected) {
return Promise.resolve();
- 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 _prepareOffsetRequest
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
SimpleConsumer.prototype._prepareOffsetRequest = function (type, commits) {
var self = this;
if (!Array.isArray(commits)) {
commits = [commits];
Function _joinGroup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
GroupConsumer.prototype._joinGroup = function () {
var self = this;
return (function _tryJoinGroup(attempt) {
attempt = attempt || 0;
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Client.prototype.init = function () {
var self = this, p = Promise.resolve(), readFile = Promise.promisify(fs.readFile);
// deprecated but backward compatible ssl cert/key options
if (self.options.ssl.certFile && self.options.ssl.keyFile) {
- 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 subscribe
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
BaseConsumer.prototype.subscribe = function (topic, partitions, options, handler) {
var self = this;
if (typeof partitions === 'function') {
handler = partitions;
- 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 null;
Avoid too many return
statements within this function. Open
return {
host: host,
port: port
};
Function updateMetadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Client.prototype.updateMetadata = function (topicNames) {
var self = this;
if (self._updateMetadata_running.isPending()) {
return self._updateMetadata_running;
- 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 _chunks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_chunks: function (buffer) {
var offset = 16, size, chunks = [];
if (buffer.toString('hex', 0, 8) === SNAPPY_MAGIC_HEADER.toString('hex')) {
// var defaultVersion = buffer.readUInt32BE(offset); offset += 4;
// var minimumVersion = buffer.readUInt32BE(offset); offset += 4;
- 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
Producer.prototype.send = function (data, options) {
var self = this, hash, promise, task;
if (!Array.isArray(data)) {
data = [data];
- 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"