fogine/couchbase-odm

View on GitHub

Showing 72 of 72 total issues

File instance.js has 653 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
const _       = require('lodash');
const Promise = require('bluebird');
const util    = require('util');

Severity: Major
Found in lib/instance.js - About 1 day to fix

    File model.js has 443 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const util    = require('util');
    const _       = require("lodash");
    const Promise = require('bluebird');
    
    const StorageAdapter = require("./storageAdapter");
    Severity: Minor
    Found in lib/model.js - About 6 hrs to fix

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

      StorageAdapter.prototype.prepend = function(key, value, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 115..128
      lib/storageAdapter.js on lines 183..196
      lib/storageAdapter.js on lines 253..266
      lib/storageAdapter.js on lines 439..452
      lib/storageAdapter.js on lines 467..480
      lib/storageAdapter.js on lines 491..503
      lib/storageAdapter.js on lines 512..525

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

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

      StorageAdapter.prototype.replace = function(key, value, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 115..128
      lib/storageAdapter.js on lines 183..196
      lib/storageAdapter.js on lines 253..266
      lib/storageAdapter.js on lines 278..291
      lib/storageAdapter.js on lines 467..480
      lib/storageAdapter.js on lines 491..503
      lib/storageAdapter.js on lines 512..525

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

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

      StorageAdapter.prototype.append = function(key, value, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 115..128
      lib/storageAdapter.js on lines 183..196
      lib/storageAdapter.js on lines 278..291
      lib/storageAdapter.js on lines 439..452
      lib/storageAdapter.js on lines 467..480
      lib/storageAdapter.js on lines 491..503
      lib/storageAdapter.js on lines 512..525

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

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

      StorageAdapter.prototype.upsert = function(key, value, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 115..128
      lib/storageAdapter.js on lines 183..196
      lib/storageAdapter.js on lines 253..266
      lib/storageAdapter.js on lines 278..291
      lib/storageAdapter.js on lines 439..452
      lib/storageAdapter.js on lines 491..503
      lib/storageAdapter.js on lines 512..525

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

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

      StorageAdapter.prototype.touch = function(key, expiry, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 115..128
      lib/storageAdapter.js on lines 183..196
      lib/storageAdapter.js on lines 253..266
      lib/storageAdapter.js on lines 278..291
      lib/storageAdapter.js on lines 439..452
      lib/storageAdapter.js on lines 467..480
      lib/storageAdapter.js on lines 512..525

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

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

      StorageAdapter.prototype.unlock = function(key, cas, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 115..128
      lib/storageAdapter.js on lines 183..196
      lib/storageAdapter.js on lines 253..266
      lib/storageAdapter.js on lines 278..291
      lib/storageAdapter.js on lines 439..452
      lib/storageAdapter.js on lines 467..480
      lib/storageAdapter.js on lines 491..503

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

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

      StorageAdapter.prototype.getAndTouch = function(key, expiry, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 183..196
      lib/storageAdapter.js on lines 253..266
      lib/storageAdapter.js on lines 278..291
      lib/storageAdapter.js on lines 439..452
      lib/storageAdapter.js on lines 467..480
      lib/storageAdapter.js on lines 491..503
      lib/storageAdapter.js on lines 512..525

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

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

      StorageAdapter.prototype.insert = function(key, data, options) {
      
          var self = this;
      
          return new Promise(function(resolve, reject) {
      Severity: Major
      Found in lib/storageAdapter.js and 7 other locations - About 4 hrs to fix
      lib/storageAdapter.js on lines 115..128
      lib/storageAdapter.js on lines 253..266
      lib/storageAdapter.js on lines 278..291
      lib/storageAdapter.js on lines 439..452
      lib/storageAdapter.js on lines 467..480
      lib/storageAdapter.js on lines 491..503
      lib/storageAdapter.js on lines 512..525

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

      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

      StorageAdapter.prototype.getReplica = function(key, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 1 other location - About 4 hrs to fix
      lib/storageAdapter.js on lines 137..150

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

      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

      StorageAdapter.prototype.getAndLock = function(key, options) {
      
          var self = this;
          return new Promise(function(resolve, reject) {
      
      
      Severity: Major
      Found in lib/storageAdapter.js and 1 other location - About 4 hrs to fix
      lib/storageAdapter.js on lines 159..172

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

      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

          return this.Model.runHooks(HookTypes.beforeCreate, this, options).then(function() {
      
              //validate
              try {
                  self.sanitize();
      Severity: Major
      Found in lib/instance.js and 2 other locations - About 4 hrs to fix
      lib/instance.js on lines 715..747
      lib/instance.js on lines 837..889

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

      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

          return this.Model.runHooks(HookTypes.beforeUpdate, this, options).then(function() {
      
              //validate & sanitize data
              try {
                  self.sanitize();
      Severity: Major
      Found in lib/instance.js and 2 other locations - About 4 hrs to fix
      lib/instance.js on lines 715..747
      lib/instance.js on lines 771..808

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

      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

          return this.Model.runHooks(HookTypes.beforeDestroy, this, options).then(function() {
              return self.getRefDocs();
          }).bind({}).then(function(docs) {//remove ref docs
              this.docs = docs;
              this.timestamps = self._touchTimestamps(undefined, {touchDeletedAt: true});
      Severity: Major
      Found in lib/instance.js and 2 other locations - About 4 hrs to fix
      lib/instance.js on lines 771..808
      lib/instance.js on lines 837..889

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

      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

      Document.prototype.inspect = function() {
          var key = this.options && this.options.key;
          var cas = key && this.options.cas;
          var out = '[object CouchbaseDocument:\n';
          out += "    key: '" + key + "'\n";
      Severity: Major
      Found in lib/document.js and 1 other location - About 3 hrs to fix
      lib/instance.js on lines 1063..1072

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

      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

      Instance.prototype.inspect = function() {
          var key = this.options && this.options.key;
          var cas = key && this.options.cas;
          var out = '[object CouchbaseInstance:\n';
          out += "    key: '" + key + "'\n";
      Severity: Major
      Found in lib/instance.js and 1 other location - About 3 hrs to fix
      lib/document.js on lines 266..275

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

      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

              self[getByRefDocFnName] = Promise.method(function(id, options) {
                  options = _.clone(options || {});
                  if (!(id instanceof self.RefDocKey)) {
                      id = self.buildRefDocKey(id, {
                          index: indexName,
      Severity: Major
      Found in lib/model.js and 1 other location - About 3 hrs to fix
      lib/model.js on lines 781..791

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

      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

              self[getByRefDocOrFailFnName] = Promise.method(function(id, options) {
                  options = _.clone(options || {});
                  if (!(id instanceof self.RefDocKey)) {
                      id = self.buildRefDocKey(id, {
                          index: indexName,
      Severity: Major
      Found in lib/model.js and 1 other location - About 3 hrs to fix
      lib/model.js on lines 767..777

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

      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

      IncrementalKey.prototype.setId = function(id) {
          if (id !== undefined) {
              let regx = /^[0-9]+$/;
              if ((id + '').match(regx) === null) {
                  throw new KeyError('Failed to set `id`. The value must be an integer (or a string with integer value), got: ' + id);
      Severity: Major
      Found in lib/key/incrementalKey.js and 1 other location - About 3 hrs to fix
      lib/key/uuid4Key.js on lines 36..45

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

      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

      Severity
      Category
      Status
      Source
      Language