oleksiyk/riakfs

View on GitHub
lib/index.js

Summary

Maintainability
F
2 wks
Test Coverage

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

'use strict';

var path    = require('path');
var _       = require('lodash');
var Promise = require('bluebird');
Severity: Major
Found in lib/index.js - About 4 days to fix

    Function open has 180 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    RiakFs.prototype.open = function (_filename, flags, mode, callback) {
        var self = this;
    
        function _open() {
            var d, p = Promise.resolve({ isDirectory: true }), options = {};
    Severity: Major
    Found in lib/index.js - About 7 hrs to fix

      Function _open has 168 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _open() {
              var d, p = Promise.resolve({ isDirectory: true }), options = {};
      
              if (typeof _filename === 'object') {
                  options = _filename;
      Severity: Major
      Found in lib/index.js - About 6 hrs to fix

        Function _rename has 155 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        RiakFs.prototype._rename = function (_old, _new, options) {
            var self = this, file, vclock;
        
            return Promise.all([
                self.riak.get({
        Severity: Major
        Found in lib/index.js - About 6 hrs to fix

          Function share has 154 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          RiakFs.prototype.share = function (_path, root, alias, readOnly, callback) {
              var self = this, dstPath = '/Shared/' + alias, p = Promise.resolve(), _p;
          
              _path = _normalizePath(_path);
          
          
          Severity: Major
          Found in lib/index.js - About 6 hrs to fix

            Function unshare has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            RiakFs.prototype.unshare = function (__path, root, callback) {
                var dir;
                if (typeof root === 'function') {
                    callback = root;
                }
            Severity: Major
            Found in lib/index.js - About 3 hrs to fix

              Function mkdir has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              RiakFs.prototype.mkdir = function (__path, mode, callback) {
                  var self = this, options = {};
              
                  if (typeof mode === 'function') {
                      callback = mode;
              Severity: Major
              Found in lib/index.js - About 3 hrs to fix

                Function unlink has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                RiakFs.prototype.unlink = function (_filename, callback) {
                    var self = this, file, options = {};
                
                    if (typeof _filename === 'object') {
                        options = _filename;
                Severity: Major
                Found in lib/index.js - About 3 hrs to fix

                  Function rename has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  RiakFs.prototype.rename = function (_oldName, _newName, callback) {
                      var self = this, options = {};
                  
                      if (typeof _oldName === 'object') {
                          options = _oldName;
                  Severity: Major
                  Found in lib/index.js - About 2 hrs to fix

                    Function _mkdir has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function _mkdir() {
                            return self._readLink(__path).spread(function (fs, _path, readOnly) {
                                var d = path.dirname(_path), p = Promise.resolve(true);
                    
                                if (_path === '/') {
                    Severity: Major
                    Found in lib/index.js - About 2 hrs to fix

                      Function read has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      RiakFs.prototype.read = function (fd, buffer, offset, length, position, callback) {
                          var p, n, oldPosition;
                      
                          offset = offset | 0;
                          length = length | 0;
                      Severity: Major
                      Found in lib/index.js - About 2 hrs to fix

                        Function rmdir has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        RiakFs.prototype.rmdir = function (__path, callback) {
                            if (typeof __path === 'object') {
                                __path = __path.filename;
                            }
                        
                        
                        Severity: Major
                        Found in lib/index.js - About 2 hrs to fix

                          Function write has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          RiakFs.prototype.write = function (fd, buffer, offset, length, position, callback) {
                              var p, n;
                          
                              offset = offset | 0;
                              length = length | 0;
                          Severity: Major
                          Found in lib/index.js - About 2 hrs to fix

                            Function readdir2 has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            RiakFs.prototype.readdir2 = function (__path, max, marker, callback) {
                                var self = this;
                            
                                return self._readLink(__path).spread(function (fs, _path) {
                                    var searchParams = {
                            Severity: Major
                            Found in lib/index.js - About 2 hrs to fix

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

                              RiakFs.prototype.read = function (fd, buffer, offset, length, position, callback) {
                                  var p, n, oldPosition;
                              
                                  offset = offset | 0;
                                  length = length | 0;
                              Severity: Minor
                              Found in lib/index.js - About 2 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 close has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              RiakFs.prototype.close = function (fd, callback) {
                                  var p;
                              
                                  if (!fd || !fd.file || fd.closed) {
                                      return Promise.reject(new RiakFsError('EBADF', 'Invalid file descriptor')).nodeify(callback);
                              Severity: Major
                              Found in lib/index.js - About 2 hrs to fix

                                Function write has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                RiakFs.prototype.write = function (fd, buffer, offset, length, position, callback) {
                                    var p, n;
                                
                                    offset = offset | 0;
                                    length = length | 0;
                                Severity: Minor
                                Found in lib/index.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 stat has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                RiakFs.prototype.stat = function (__path, callback) {
                                    var self = this, map;
                                
                                    return self._readLink(__path).spread(function (fs, _path, readOnly) {
                                        if (_path === '/') {
                                Severity: Minor
                                Found in lib/index.js - About 1 hr to fix

                                  Function futimes has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  RiakFs.prototype.futimes = function (fd, atime, mtime, callback) {
                                      if (!fd || fd.closed || !fd.file) {
                                          return Promise.reject(new RiakFsError('EBADF', 'Invalid file descriptor')).nodeify(callback);
                                      }
                                  
                                  
                                  Severity: Minor
                                  Found in lib/index.js - About 1 hr to fix

                                    Function updateMeta2 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    RiakFs.prototype.updateMeta2 = function (_filename, fn) {
                                        return this._readLink(_filename).spread(function (fs, filename, readOnly) {
                                            var file;
                                    
                                            if (fs.riak.usingFailover || fs.options.readOnly) {
                                    Severity: Minor
                                    Found in lib/index.js - About 1 hr to fix

                                      Function futimes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      RiakFs.prototype.futimes = function (fd, atime, mtime, callback) {
                                          if (!fd || fd.closed || !fd.file) {
                                              return Promise.reject(new RiakFsError('EBADF', 'Invalid file descriptor')).nodeify(callback);
                                          }
                                      
                                      
                                      Severity: Minor
                                      Found in lib/index.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 open has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      RiakFs.prototype.open = function (_filename, flags, mode, callback) {
                                          var self = this;
                                      
                                          function _open() {
                                              var d, p = Promise.resolve({ isDirectory: true }), options = {};
                                      Severity: Minor
                                      Found in lib/index.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 _readLink has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      RiakFs.prototype._readLink = function (_path) {
                                          var self = this, readOnly = false;
                                      
                                          _path = _normalizePath(_path);
                                      
                                      
                                      Severity: Minor
                                      Found in lib/index.js - About 1 hr to fix

                                        Function rmTree has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        RiakFs.prototype.rmTree = function (_path, callback) {
                                            var self = this, options = {};
                                        
                                            if (typeof _path === 'object') {
                                                options = _path;
                                        Severity: Minor
                                        Found in lib/index.js - About 1 hr to fix

                                          Function read has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          RiakFs.prototype.read = function (fd, buffer, offset, length, position, callback) {
                                          Severity: Minor
                                          Found in lib/index.js - About 45 mins to fix

                                            Function write has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            RiakFs.prototype.write = function (fd, buffer, offset, length, position, callback) {
                                            Severity: Minor
                                            Found in lib/index.js - About 45 mins to fix

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

                                              RiakFs.prototype.close = function (fd, callback) {
                                                  var p;
                                              
                                                  if (!fd || !fd.file || fd.closed) {
                                                      return Promise.reject(new RiakFsError('EBADF', 'Invalid file descriptor')).nodeify(callback);
                                              Severity: Minor
                                              Found in lib/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 share has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                              RiakFs.prototype.share = function (_path, root, alias, readOnly, callback) {
                                              Severity: Minor
                                              Found in lib/index.js - About 35 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                        return Promise.resolve(0);
                                                Severity: Major
                                                Found in lib/index.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                      return p.then(function () {
                                                          return Promise.all([
                                                              self.riak.get({
                                                                  bucket: self.filesBucket,
                                                                  key: _path,
                                                  Severity: Major
                                                  Found in lib/index.js - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                        return p
                                                            .then(function () {
                                                                return _read(buffer.slice(offset), length);
                                                            })
                                                            .then(function () {
                                                    Severity: Major
                                                    Found in lib/index.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                          return fd.fs.riak.put({
                                                              bucket: fd.fs.filesBucket,
                                                              key: fd.filename,
                                                              vclock: fd.vclock,
                                                              content: {
                                                      Severity: Major
                                                      Found in lib/index.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return Promise.reject(new RiakFsError('EINVAL', 'Alias cannot be a path')).nodeify(callback);
                                                        Severity: Major
                                                        Found in lib/index.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                          return {
                                                                              flags: flags,
                                                                              file: file,
                                                                              fs: fs,
                                                                              position: 0,
                                                          Severity: Major
                                                          Found in lib/index.js - About 30 mins to fix

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

                                                            RiakFs.prototype.share = function (_path, root, alias, readOnly, callback) {
                                                                var self = this, dstPath = '/Shared/' + alias, p = Promise.resolve(), _p;
                                                            
                                                                _path = _normalizePath(_path);
                                                            
                                                            
                                                            Severity: Minor
                                                            Found in lib/index.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 2 locations. Consider refactoring.
                                                            Open

                                                                        return Promise.all([
                                                                            _tfs.riak.get({
                                                                                bucket: _tfs.filesBucket,
                                                                                key: dstPath,
                                                                                type: _tfs.options.metaType
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 4 hrs to fix
                                                            lib/index.js on lines 374..421

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

                                                            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

                                                                    return Promise.all([
                                                                        fs.riak.get({
                                                                            bucket: fs.filesBucket,
                                                                            key: _path,
                                                                            type: fs.options.metaType
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 4 hrs to fix
                                                            lib/index.js on lines 1608..1656

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

                                                            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

                                                                            return fs.riak.put({
                                                                                bucket: fs.filesBucket,
                                                                                key: _path,
                                                                                vclock: reply.vclock,
                                                                                content: {
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 3 hrs to fix
                                                            lib/index.js on lines 1675..1695

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

                                                            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

                                                                        return self.riak.put({
                                                                            bucket: self.filesBucket,
                                                                            key: _path,
                                                                            vclock: sreply.vclock,
                                                                            content: {
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 3 hrs to fix
                                                            lib/index.js on lines 1750..1767

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

                                                            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 (mtime !== null) {
                                                                    if (typeof mtime === 'number') {
                                                                        mtime = new Date(mtime);
                                                                    }
                                                            
                                                            
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 1294..1303

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

                                                            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

                                                                            return _tfs.riak.put({
                                                                                bucket: _tfs.filesBucket,
                                                                                key: dstPath,
                                                                                vclock: dreply.vclock,
                                                                                content: {
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 915..927

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

                                                            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 (atime !== null) {
                                                                    if (typeof atime === 'number') {
                                                                        atime = new Date(atime);
                                                                    }
                                                            
                                                            
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 1305..1315

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

                                                            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

                                                                                        return _tfs.riak.put({
                                                                                            bucket: _tfs.filesBucket,
                                                                                            key: dstPath,
                                                                                            vclock: dreply.vclock,
                                                                                            content: {
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 1643..1655

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

                                                            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

                                                                if (!fd.chunk || fd.chunk.n !== n) {
                                                                    fd.chunk = new Chunk(fd.file, n, fd.fs);
                                                                    p = fd.chunk.load();
                                                                } else {
                                                                    p = Promise.resolve();
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 812..817

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

                                                            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

                                                                if (!fd.chunk || fd.chunk.n !== n) {
                                                                    fd.chunk = new Chunk(fd.file, n, fd.fs);
                                                                    p = fd.chunk.load();
                                                                } else {
                                                                    p = Promise.resolve();
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 741..746

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

                                                            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

                                                                if (position !== null) {
                                                                    position = position | 0;
                                                                    if (position > fd.file.size) {
                                                                        return Promise.reject(new RiakFsError('EINVAL', 'The specified file offset is invalid')).nodeify(callback);
                                                                    }
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 802..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 76.

                                                            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

                                                                if (position !== null) {
                                                                    position = position | 0;
                                                                    if (position > fd.file.size) {
                                                                        return Promise.reject(new RiakFsError('EINVAL', 'The specified file offset is invalid')).nodeify(callback);
                                                                    }
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 2 hrs to fix
                                                            lib/index.js on lines 723..729

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

                                                            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 (!fd || fd.closed || !fd.file || !/^(r\+|w|w\+|wx|wx\+|a|a\+|ax|ax\+)$/.test(fd.flags)) {
                                                                    return Promise.reject(new RiakFsError('EBADF', 'Invalid file descriptor')).nodeify(callback);
                                                                }
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 702..704

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

                                                            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 (!fd || fd.closed || !fd.file || !/^(w\+|wx\+|r|r\+|a\+|ax\+)$/.test(fd.flags)) {
                                                                    return Promise.reject(new RiakFsError('EBADF', 'Invalid file descriptor')).nodeify(callback);
                                                                }
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 781..783

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

                                                            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

                                                                        return Promise.all([
                                                                            fs.riak.get({
                                                                                bucket: fs.filesBucket,
                                                                                key: filename,
                                                                                deletedvclock: true,
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 285..341

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

                                                                        return Promise.all([
                                                                            fs.riak.get({
                                                                                bucket: fs.filesBucket,
                                                                                key: _path,
                                                                                deletedvclock: true,
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 476..612

                                                            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

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

                                                                                        return {
                                                                                            oldFile: oldFile,
                                                                                            flags: flags,
                                                                                            position: 0,
                                                                                            file: file,
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 551..560

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

                                                            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

                                                                                    return {
                                                                                        oldFile: oldFile,
                                                                                        flags: flags,
                                                                                        position: 0,
                                                                                        file: file,
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 526..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 60.

                                                            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 (self.riak.usingFailover || _tfs.riak.usingFailover || _tfs.options.readOnly || self.options.readOnly) {
                                                                        throw new RiakFsError('EROFS', 'Read-only filesystem');
                                                                    }
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 1055..1057

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

                                                            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 (nfs.riak.usingFailover || ofs.riak.usingFailover || nfs.options.readOnly || ofs.options.readOnly) {
                                                                        throw new RiakFsError('EROFS', 'Read-only filesystem');
                                                                    }
                                                            Severity: Major
                                                            Found in lib/index.js and 1 other location - About 1 hr to fix
                                                            lib/index.js on lines 1603..1605

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

                                                            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 (fd.fs.options.events === true) {
                                                                        fd.fs.emit('change', fd.filename, new Stats(fd.file, false));
                                                                    }
                                                            Severity: Minor
                                                            Found in lib/index.js and 1 other location - About 55 mins to fix
                                                            lib/index.js on lines 674..676

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

                                                            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 (fd.fs.options.events === true) {
                                                                                fd.fs.emit('new', fd.filename, new Stats(fd.file, false));
                                                                            }
                                                            Severity: Minor
                                                            Found in lib/index.js and 1 other location - About 55 mins to fix
                                                            lib/index.js on lines 1335..1337

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

                                                            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

                                                                            fs.riak.del({
                                                                                bucket: fs.filesBucket,
                                                                                key: filename,
                                                                                vclock: reply.vclock,
                                                                                type: fs.options.metaType
                                                            Severity: Major
                                                            Found in lib/index.js and 2 other locations - About 45 mins to fix
                                                            lib/index.js on lines 407..412
                                                            lib/index.js on lines 1786..1791

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

                                                            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 _tfs.riak.del({
                                                                                bucket: _tfs.filesBucket,
                                                                                key: __path,
                                                                                vclock: dreply.vclock,
                                                                                type: _tfs.options.metaType
                                                            Severity: Major
                                                            Found in lib/index.js and 2 other locations - About 45 mins to fix
                                                            lib/index.js on lines 156..161
                                                            lib/index.js on lines 407..412

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

                                                            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

                                                                        p = fs.riak.del({
                                                                            bucket: fs.filesBucket,
                                                                            key: _path,
                                                                            vclock: reply.vclock,
                                                                            type: fs.options.metaType
                                                            Severity: Major
                                                            Found in lib/index.js and 2 other locations - About 45 mins to fix
                                                            lib/index.js on lines 156..161
                                                            lib/index.js on lines 1786..1791

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

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

                                                                        return self.riak.get({
                                                                            bucket: self.filesBucket,
                                                                            key: p,
                                                                            type: self.options.metaType
                                                                        })
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1726..1770
                                                            lib/index.js on lines 1775..1798

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

                                                            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

                                                                        map = new Riak.CRDT.Map(self.riak, {
                                                                            bucket: self.statsBucket,
                                                                            type: self.options.statsType,
                                                                            key: 'stats'
                                                                        });
                                                            Severity: Minor
                                                            Found in lib/index.js and 1 other location - About 35 mins to fix
                                                            lib/index.js on lines 1823..1827

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

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

                                                                            p = fs.riak.get({
                                                                                bucket: fs.filesBucket,
                                                                                key: d,
                                                                                type: fs.options.metaType
                                                                            })
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1726..1770
                                                            lib/index.js on lines 1775..1798

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

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

                                                                                    return _tfs.riak.get({
                                                                                        bucket: _tfs.filesBucket,
                                                                                        key: dstPath,
                                                                                        type: _tfs.options.metaType
                                                                                    }).then(function (dreply) {
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1726..1770
                                                            lib/index.js on lines 1775..1798

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

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

                                                                    p = self.riak.get({
                                                                        bucket: self.filesBucket,
                                                                        key: _p,
                                                                        type: self.options.metaType
                                                                    }).then(function (reply) {
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1726..1770
                                                            lib/index.js on lines 1775..1798

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

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

                                                                    return fs.riak.get({
                                                                        bucket: fs.filesBucket,
                                                                        key: _path,
                                                                        type: fs.options.metaType
                                                                    })
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1726..1770
                                                            lib/index.js on lines 1775..1798

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

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

                                                                            fs.riak.get({
                                                                                bucket: fs.filesBucket,
                                                                                key: _path,
                                                                                type: fs.options.metaType
                                                                            })
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1726..1770
                                                            lib/index.js on lines 1775..1798

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

                                                            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

                                                                var map = new Riak.CRDT.Map(self.riak, {
                                                                    bucket: self.statsBucket,
                                                                    type: self.options.statsType,
                                                                    key: 'stats'
                                                                });
                                                            Severity: Minor
                                                            Found in lib/index.js and 1 other location - About 35 mins to fix
                                                            lib/index.js on lines 1138..1142

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

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

                                                                    return fs.riak.get({
                                                                        bucket: fs.filesBucket,
                                                                        key: filename,
                                                                        type: fs.options.metaType
                                                                    })
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1726..1770
                                                            lib/index.js on lines 1775..1798

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

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

                                                                    return fs.riak.get({
                                                                        bucket: fs.filesBucket,
                                                                        key: _path,
                                                                        type: fs.options.metaType
                                                                    })
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1775..1798

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

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

                                                                        return _tfs.riak.get({
                                                                            bucket: _tfs.filesBucket,
                                                                            key: __path,
                                                                            type: _tfs.options.metaType
                                                                        }).then(function (dreply) {
                                                            Severity: Major
                                                            Found in lib/index.js and 8 other locations - About 35 mins to fix
                                                            lib/index.js on lines 108..169
                                                            lib/index.js on lines 463..473
                                                            lib/index.js on lines 900..928
                                                            lib/index.js on lines 1145..1152
                                                            lib/index.js on lines 1167..1177
                                                            lib/index.js on lines 1505..1522
                                                            lib/index.js on lines 1551..1562
                                                            lib/index.js on lines 1726..1770

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

                                                            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