oleksiyk/kafka

View on GitHub

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)) {
Severity: Minor
Found in lib/group_consumer.js - About 1 hr to fix

    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;
    Severity: Minor
    Found in lib/assignment/strategies/consistent.js - About 1 hr to fix

      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 = {};
      Severity: Minor
      Found in lib/group_consumer.js - About 1 hr to fix

        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) {
        Severity: Minor
        Found in lib/group_admin.js - About 1 hr to fix

          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];
          Severity: Minor
          Found in lib/client.js - About 1 hr to fix

            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();
            Severity: Minor
            Found in lib/connection.js - About 1 hr to fix

            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];
            Severity: Minor
            Found in lib/simple_consumer.js - About 1 hr to fix

              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;
              Severity: Minor
              Found in lib/group_consumer.js - About 1 hr to fix

                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) {
                Severity: Minor
                Found in lib/client.js - About 45 mins to fix

                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;
                Severity: Minor
                Found in lib/base_consumer.js - About 45 mins to fix

                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;
                Severity: Major
                Found in lib/base_consumer.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return {
                          host: host,
                          port: port
                      };
                  Severity: Major
                  Found in lib/client.js - About 30 mins to fix

                    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;
                    Severity: Minor
                    Found in lib/client.js - About 25 mins to fix

                    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;
                    Severity: Minor
                    Found in lib/protocol/misc/compression.js - About 25 mins to fix

                    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];
                    Severity: Minor
                    Found in lib/producer.js - About 25 mins to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language