oleksiyk/binary-protocol

View on GitHub
lib/protobuf/index.js

Summary

Maintainability
F
6 days
Test Coverage

File index.js has 471 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var Long     = require('long');
var Protocol = require('../index');
var pbschema = require('protocol-buffers-schema');
Severity: Minor
Found in lib/protobuf/index.js - About 7 hrs to fix

    Function createProtobufProtocol has 175 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function createProtobufProtocol(proto, options) {
        var _Protocol = ProtobufProtocol.createProtocol();
        var definitions = {};
    
        options = _.defaults(options || {}, {
    Severity: Major
    Found in lib/protobuf/index.js - About 7 hrs to fix

      Function createProtobufProtocol has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function createProtobufProtocol(proto, options) {
          var _Protocol = ProtobufProtocol.createProtocol();
          var definitions = {};
      
          options = _.defaults(options || {}, {
      Severity: Minor
      Found in lib/protobuf/index.js - About 6 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 defineMessage has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function defineMessage(namespace, msg) {
              var fullName = namespace ? namespace + '.' + msg.name : msg.name;
              definitions[fullName] = _.zipObject(_.map(msg.fields, 'tag'), msg.fields);
      
              _Protocol.define(msg.name, {
      Severity: Major
      Found in lib/protobuf/index.js - About 2 hrs to fix

        Function parseProto has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function parseProto(data) {
                var schema = pbschema.parse(data);
        
                _.each(schema.messages, function (msg) {
                    defineMessage(schema.package, msg);
        Severity: Minor
        Found in lib/protobuf/index.js - About 1 hr to fix

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

              function defaultFieldValue(field) {
                  var _default = field.options.default;
                  if (options.typeSpecificDefaults === false && _default === undefined) {
                      return undefined;
                  }
          Severity: Minor
          Found in lib/protobuf/index.js - About 1 hr to fix

            Function getFieldWireType has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getFieldWireType(field) {
                if (field.repeated && field.options.packed === 'true') {
                    return 2;
                }
            
            
            Severity: Minor
            Found in lib/protobuf/index.js - About 1 hr to fix

              Function read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  read: function (field) {
                      var self = this;
                      var len, i;
              
                      if (field.type === 'bytes' || field.type === 'string') {
              Severity: Minor
              Found in lib/protobuf/index.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 read has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  read: function (msgName, fields) {
                      var self = this;
                      var tag, field, fname, type;
              
                      self.UVarint('meta');
              Severity: Minor
              Found in lib/protobuf/index.js - About 35 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 2 locations. Consider refactoring.
              Open

                  write: function (value) {
                      value = Long.fromValue(value);
                      this.buffer.writeInt32LE(value.getLowBits(), this.offset);
                      this.buffer.writeInt32LE(value.getHighBits(), this.offset + 4);
                      this.offset += 8;
              Severity: Major
              Found in lib/protobuf/index.js and 1 other location - About 3 hrs to fix
              lib/protobuf/index.js on lines 373..378

              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 95.

              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

                  write: function (value) {
                      value = Long.fromValue(value);
                      this.buffer.writeUInt32LE(value.getLowBitsUnsigned(), this.offset);
                      this.buffer.writeUInt32LE(value.getHighBitsUnsigned(), this.offset + 4);
                      this.offset += 8;
              Severity: Major
              Found in lib/protobuf/index.js and 1 other location - About 3 hrs to fix
              lib/protobuf/index.js on lines 396..401

              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 95.

              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

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

                  read: function () {
                      var l = new Long(this.buffer.readUInt32LE(this.offset), this.buffer.readUInt32LE(this.offset + 4), true);
                      this.offset += 8;
                      return l;
                  },
              Severity: Major
              Found in lib/protobuf/index.js and 1 other location - About 1 hr to fix
              lib/index.js on lines 180..184

              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 73.

              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

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

                  read: function () {
                      var l = new Long(this.buffer.readInt32LE(this.offset), this.buffer.readInt32LE(this.offset + 4));
                      this.offset += 8;
                      return l;
                  },
              Severity: Major
              Found in lib/protobuf/index.js and 1 other location - About 1 hr to fix
              lib/index.js on lines 150..154

              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 72.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('float', {
                  read: function () {
                      this.FloatLE();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('int64', {
                  read: function () {
                      this.Varint64();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('sint64', {
                  read: function () {
                      this.SVarint64();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('uint64', {
                  read: function () {
                      this.UVarint64();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('int32', {
                  read: function () {
                      this.Varint();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('sfixed32', {
                  read: function () {
                      this.Int32LE();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('fixed32', {
                  read: function () {
                      this.UInt32LE();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('double', {
                  read: function () {
                      this.DoubleLE();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('uint32', {
                  read: function () {
                      this.UVarint();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 303..310
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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 10 locations. Consider refactoring.
              Open

              ProtobufProtocol.define('sint32', {
                  read: function () {
                      this.SVarint();
                  },
                  write: function (value) {
              Severity: Major
              Found in lib/protobuf/index.js and 9 other locations - About 1 hr to fix
              lib/protobuf/index.js on lines 276..283
              lib/protobuf/index.js on lines 294..301
              lib/protobuf/index.js on lines 312..319
              lib/protobuf/index.js on lines 321..328
              lib/protobuf/index.js on lines 330..337
              lib/protobuf/index.js on lines 339..346
              lib/protobuf/index.js on lines 348..355
              lib/protobuf/index.js on lines 357..364
              lib/protobuf/index.js on lines 381..388

              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 55.

              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

                      _.each(msg.enums, function (_enum) {
                          defineEnum(namespace ? (namespace + '.' + msg.name) : msg.name, _enum);
                      });
              Severity: Minor
              Found in lib/protobuf/index.js and 1 other location - About 50 mins to fix
              lib/protobuf/index.js on lines 200..202

              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 52.

              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

                      _.each(msg.messages, function (_msg) {
                          defineMessage(namespace ? (namespace + '.' + msg.name) : msg.name, _msg);
                      });
              Severity: Minor
              Found in lib/protobuf/index.js and 1 other location - About 50 mins to fix
              lib/protobuf/index.js on lines 204..206

              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 52.

              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