oleksiyk/riakfs

View on GitHub

Showing 75 of 75 total issues

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

          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

          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

                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

                    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

                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

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

                  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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language