lib/zlib.js

Summary

Maintainability
F
5 days
Test Coverage

File zlib.js has 456 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Severity: Minor
Found in lib/zlib.js - About 6 hrs to fix

    Function Zlib has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    function Zlib(opts, mode) {
      this._opts = opts = opts || {};
      this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK;
    
      Transform.call(this, opts);
    Severity: Minor
    Found in lib/zlib.js - About 4 hrs 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 _processChunk has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
      var availInBefore = chunk && chunk.length;
      var availOutBefore = this._chunkSize - this._offset;
      var inOff = 0;
    
    
    Severity: Minor
    Found in lib/zlib.js - About 3 hrs 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 _processChunk has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
      var availInBefore = chunk && chunk.length;
      var availOutBefore = this._chunkSize - this._offset;
      var inOff = 0;
    
    
    Severity: Major
    Found in lib/zlib.js - About 3 hrs to fix

      Function Zlib has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Zlib(opts, mode) {
        this._opts = opts = opts || {};
        this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK;
      
        Transform.call(this, opts);
      Severity: Major
      Found in lib/zlib.js - About 3 hrs to fix

        Function callback has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function callback(availInAfter, availOutAfter) {
            if (self._hadError)
              return;
        
            var have = availOutBefore - availOutAfter;
        Severity: Minor
        Found in lib/zlib.js - About 1 hr to fix

          Function _transform has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          Zlib.prototype._transform = function(chunk, encoding, cb) {
            var flushFlag;
            var ws = this._writableState;
            var ending = ws.ending || ws.ended;
            var last = ending && (!chunk || ws.length === chunk.length);
          Severity: Minor
          Found in lib/zlib.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 flush has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          Zlib.prototype.flush = function(kind, callback) {
            var ws = this._writableState;
          
            if (util.isFunction(kind) || (util.isUndefined(kind) && !callback)) {
              callback = kind;
          Severity: Minor
          Found in lib/zlib.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

          Consider simplifying this complex logical expression.
          Open

              if (opts.flush !== binding.Z_NO_FLUSH &&
                  opts.flush !== binding.Z_PARTIAL_FLUSH &&
                  opts.flush !== binding.Z_SYNC_FLUSH &&
                  opts.flush !== binding.Z_FULL_FLUSH &&
                  opts.flush !== binding.Z_FINISH &&
          Severity: Major
          Found in lib/zlib.js - About 40 mins to fix

            Function params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            Zlib.prototype.params = function(level, strategy, callback) {
              if (level < exports.Z_MIN_LEVEL ||
                  level > exports.Z_MAX_LEVEL) {
                throw new RangeError('Invalid compression level: ' + level);
              }
            Severity: Minor
            Found in lib/zlib.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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                if (opts.strategy != exports.Z_FILTERED &&
                    opts.strategy != exports.Z_HUFFMAN_ONLY &&
                    opts.strategy != exports.Z_RLE &&
                    opts.strategy != exports.Z_FIXED &&
                    opts.strategy != exports.Z_DEFAULT_STRATEGY) {
            Severity: Major
            Found in lib/zlib.js and 2 other locations - About 2 hrs to fix
            lib/assert.js on lines 161..165
            lib/zlib.js on lines 303..307

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                if (opts.flush !== binding.Z_NO_FLUSH &&
                    opts.flush !== binding.Z_PARTIAL_FLUSH &&
                    opts.flush !== binding.Z_SYNC_FLUSH &&
                    opts.flush !== binding.Z_FULL_FLUSH &&
                    opts.flush !== binding.Z_FINISH &&
            Severity: Major
            Found in lib/zlib.js and 2 other locations - About 2 hrs to fix
            lib/assert.js on lines 161..165
            lib/zlib.js on lines 343..347

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

            exports.gunzip = function(buffer, opts, callback) {
              if (util.isFunction(opts)) {
                callback = opts;
                opts = {};
              }
            Severity: Major
            Found in lib/zlib.js and 5 other locations - About 1 hr to fix
            lib/zlib.js on lines 129..135
            lib/zlib.js on lines 141..147
            lib/zlib.js on lines 153..159
            lib/zlib.js on lines 165..171
            lib/zlib.js on lines 189..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 62.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

            exports.deflateRaw = function(buffer, opts, callback) {
              if (util.isFunction(opts)) {
                callback = opts;
                opts = {};
              }
            Severity: Major
            Found in lib/zlib.js and 5 other locations - About 1 hr to fix
            lib/zlib.js on lines 129..135
            lib/zlib.js on lines 153..159
            lib/zlib.js on lines 165..171
            lib/zlib.js on lines 177..183
            lib/zlib.js on lines 189..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 62.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

            exports.inflate = function(buffer, opts, callback) {
              if (util.isFunction(opts)) {
                callback = opts;
                opts = {};
              }
            Severity: Major
            Found in lib/zlib.js and 5 other locations - About 1 hr to fix
            lib/zlib.js on lines 129..135
            lib/zlib.js on lines 141..147
            lib/zlib.js on lines 153..159
            lib/zlib.js on lines 177..183
            lib/zlib.js on lines 189..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 62.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

            exports.inflateRaw = function(buffer, opts, callback) {
              if (util.isFunction(opts)) {
                callback = opts;
                opts = {};
              }
            Severity: Major
            Found in lib/zlib.js and 5 other locations - About 1 hr to fix
            lib/zlib.js on lines 129..135
            lib/zlib.js on lines 141..147
            lib/zlib.js on lines 153..159
            lib/zlib.js on lines 165..171
            lib/zlib.js on lines 177..183

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 62.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

            exports.unzip = function(buffer, opts, callback) {
              if (util.isFunction(opts)) {
                callback = opts;
                opts = {};
              }
            Severity: Major
            Found in lib/zlib.js and 5 other locations - About 1 hr to fix
            lib/zlib.js on lines 129..135
            lib/zlib.js on lines 141..147
            lib/zlib.js on lines 165..171
            lib/zlib.js on lines 177..183
            lib/zlib.js on lines 189..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 62.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

            exports.gzip = function(buffer, opts, callback) {
              if (util.isFunction(opts)) {
                callback = opts;
                opts = {};
              }
            Severity: Major
            Found in lib/zlib.js and 5 other locations - About 1 hr to fix
            lib/zlib.js on lines 141..147
            lib/zlib.js on lines 153..159
            lib/zlib.js on lines 165..171
            lib/zlib.js on lines 177..183
            lib/zlib.js on lines 189..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 62.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              if (opts.windowBits) {
                if (opts.windowBits < exports.Z_MIN_WINDOWBITS ||
                    opts.windowBits > exports.Z_MAX_WINDOWBITS) {
                  throw new Error('Invalid windowBits: ' + opts.windowBits);
                }
            Severity: Major
            Found in lib/zlib.js and 3 other locations - About 1 hr to fix
            lib/zlib.js on lines 314..319
            lib/zlib.js on lines 328..333
            lib/zlib.js on lines 335..340

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 61.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              if (opts.memLevel) {
                if (opts.memLevel < exports.Z_MIN_MEMLEVEL ||
                    opts.memLevel > exports.Z_MAX_MEMLEVEL) {
                  throw new Error('Invalid memLevel: ' + opts.memLevel);
                }
            Severity: Major
            Found in lib/zlib.js and 3 other locations - About 1 hr to fix
            lib/zlib.js on lines 314..319
            lib/zlib.js on lines 321..326
            lib/zlib.js on lines 328..333

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 61.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              if (opts.chunkSize) {
                if (opts.chunkSize < exports.Z_MIN_CHUNK ||
                    opts.chunkSize > exports.Z_MAX_CHUNK) {
                  throw new Error('Invalid chunk size: ' + opts.chunkSize);
                }
            Severity: Major
            Found in lib/zlib.js and 3 other locations - About 1 hr to fix
            lib/zlib.js on lines 321..326
            lib/zlib.js on lines 328..333
            lib/zlib.js on lines 335..340

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 61.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              if (opts.level) {
                if (opts.level < exports.Z_MIN_LEVEL ||
                    opts.level > exports.Z_MAX_LEVEL) {
                  throw new Error('Invalid compression level: ' + opts.level);
                }
            Severity: Major
            Found in lib/zlib.js and 3 other locations - About 1 hr to fix
            lib/zlib.js on lines 314..319
            lib/zlib.js on lines 321..326
            lib/zlib.js on lines 335..340

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 61.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            function Gunzip(opts) {
              if (!(this instanceof Gunzip)) return new Gunzip(opts);
              Zlib.call(this, opts, binding.GUNZIP);
            }
            Severity: Minor
            Found in lib/zlib.js and 2 other locations - About 30 mins to fix
            lib/zlib.js on lines 252..255
            lib/zlib.js on lines 278..281

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            function Inflate(opts) {
              if (!(this instanceof Inflate)) return new Inflate(opts);
              Zlib.call(this, opts, binding.INFLATE);
            }
            Severity: Minor
            Found in lib/zlib.js and 2 other locations - About 30 mins to fix
            lib/zlib.js on lines 265..268
            lib/zlib.js on lines 278..281

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            function InflateRaw(opts) {
              if (!(this instanceof InflateRaw)) return new InflateRaw(opts);
              Zlib.call(this, opts, binding.INFLATERAW);
            }
            Severity: Minor
            Found in lib/zlib.js and 2 other locations - About 30 mins to fix
            lib/zlib.js on lines 252..255
            lib/zlib.js on lines 265..268

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            function DeflateRaw(opts) {
              if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts);
              Zlib.call(this, opts, binding.DEFLATERAW);
            }
            Severity: Minor
            Found in lib/zlib.js and 1 other location - About 30 mins to fix
            lib/zlib.js on lines 260..263

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              if (strategy != exports.Z_FILTERED &&
                  strategy != exports.Z_HUFFMAN_ONLY &&
                  strategy != exports.Z_RLE &&
                  strategy != exports.Z_FIXED &&
            Severity: Minor
            Found in lib/zlib.js and 1 other location - About 30 mins to fix
            lib/child_process.js on lines 1141..1144

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            function Gzip(opts) {
              if (!(this instanceof Gzip)) return new Gzip(opts);
              Zlib.call(this, opts, binding.GZIP);
            }
            Severity: Minor
            Found in lib/zlib.js and 1 other location - About 30 mins to fix
            lib/zlib.js on lines 273..276

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  var res = this._handle.writeSync(flushFlag,
                                                   chunk, // in
                                                   inOff, // in_off
                                                   availInBefore, // in_len
                                                   this._buffer, // out
            Severity: Minor
            Found in lib/zlib.js and 1 other location - About 30 mins to fix
            lib/zlib.js on lines 549..555

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              var req = this._handle.write(flushFlag,
                                           chunk, // in
                                           inOff, // in_off
                                           availInBefore, // in_len
                                           this._buffer, // out
            Severity: Minor
            Found in lib/zlib.js and 1 other location - About 30 mins to fix
            lib/zlib.js on lines 529..535

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status