oleksiyk/kafka

View on GitHub

Showing 104 of 104 total issues

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