google/chromeos-filesystems

View on GitHub

Showing 29 of 78 total issues

Function exports has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    // Performs static analysis on the code to check for common errors.
Severity: Major
Found in s3fs/Gruntfile.js - About 5 hrs to fix

    Function exports has 134 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(grunt) {
      grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        // Performs static analysis on the code to check for common errors.
        jshint: {
    Severity: Major
    Found in webdavfs/Gruntfile.js - About 5 hrs to fix

      Function exports has 113 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(onMoveEntryRequested, onGetMetadataRequested) {
        describe('onMoveEntryRequested', function() {
          it('should be able to move a file ', function(done) {
            var source = 'dir11/11.txt';
            var target = '11_moved.txt';
      Severity: Major
      Found in shared_tests/onMoveEntryRequested.js - About 4 hrs to fix

        Function exports has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(fs, onDeleteEntryRequested, onGetMetadataRequested) {
          describe('onDeleteEntryRequested', function() {
            it('should remove an existing file', function(done) {
              var statOptions = {
                entryPath: '/1.txt'
        Severity: Major
        Found in shared_tests/onDeleteEntryRequested.js - About 4 hrs to fix

          Function exports has 99 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(grunt) {
            grunt.initConfig({
              pkg: grunt.file.readJSON('package.json'),
          
              // Performs static analysis on the code to check for common errors.
          Severity: Major
          Found in templatefs/Gruntfile.js - About 3 hrs to fix

            Function exports has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function(onReadFileRequested, onOpenFileRequested) {
              describe('onReadFileRequested', function() {
                it('should fail for files that have not been opened yet', function(done) {
                  var options = {
                    openRequestId: 1,
            Severity: Major
            Found in shared_tests/onReadFileRequested.js - About 3 hrs to fix

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

              module.exports = function(onCopyEntryRequested, onGetMetadataRequested) {
                describe('onCopyEntryRequested', function() {
                  it('should be able to copy files to locations that do not yet exist', function(done) {
                    var source = 'dir2/2.txt';
                    var target = '2_copied.txt';
              Severity: Major
              Found in shared_tests/onCopyEntryRequested.js - About 2 hrs to fix

                Function exports has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function(onWriteFileRequested, onReadFileRequested,
                  onOpenFileRequested) {
                    describe('onWriteFileRequested', function() {
                      it('should write the correct data to a new file', function(done) {
                        var id = 987;
                Severity: Major
                Found in shared_tests/onWriteFileRequested.js - About 2 hrs to fix

                  Function exports has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function(fs, onOpenFileRequested) {
                    describe('onOpenFileRequested', function() {
                      it('should allow attempts to create files', function(done) {
                        var options = {
                          filePath: '/new.txt',
                  Severity: Major
                  Found in shared_tests/onOpenFileRequested.js - About 2 hrs to fix

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

                    WebDAVClient.prototype.request = function(verb, url, headers, data, responseType,
                      onSuccess, onError) {
                        var xhr = new XMLHttpRequest();
                    
                        var processBody = function() {
                    Severity: Minor
                    Found in webdavfs/js/client.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 exports has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function(onGetMetadataRequested) {
                      describe('onGetMetadataRequested', function() {
                        it('should return the correct metadata object for files', function(done) {
                          var options = {
                            entryPath: '/1.txt'
                    Severity: Minor
                    Found in shared_tests/onGetMetadataRequested.js - About 1 hr to fix

                      Function exports has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function(fs, onCloseFileRequested, onOpenFileRequested) {
                        describe('onCloseFileRequested', function() {
                          it('should reject attempts to close unopened files', function(done) {
                            var options = {
                              openRequestId: 123
                      Severity: Minor
                      Found in shared_tests/onCloseFileRequested.js - About 1 hr to fix

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

                        var onDeleteEntryRequested = function(options, onSuccess, onError) {
                          if (!options.entryPath) {
                            onError('INVALID_OPERATION');
                            return;
                          }
                        Severity: Minor
                        Found in webdavfs/js/events.js - About 1 hr to fix

                          Function testFactory has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var testFactory = function(open, read, truncate) {
                            return function(file, id, length, expected) {
                              return function(done) {
                                var openOptions = {
                                  filePath: file,
                          Severity: Minor
                          Found in shared_tests/onTruncateRequested.js - About 1 hr to fix

                            Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            module.exports = function(onReadDirectoryRequested) {
                              describe('onReadDirectoryRequested', function() {
                                it('should return the correct contents for the given directory',
                                  function(done) {
                                    var options = {
                            Severity: Minor
                            Found in shared_tests/onReadDirectoryRequested.js - About 1 hr to fix

                              Function onGetMetadataRequested has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              var onGetMetadataRequested = function(options, onSuccess, onError) {
                                // Remove the leading slash from the path -- this isn't used in S3 keys.
                                var path = options.entryPath.substring(1);
                              
                                var metadata;
                              Severity: Minor
                              Found in s3fs/js/events.js - About 1 hr to fix

                                Function onTruncateRequested has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                var onTruncateRequested = function(options, onSuccess, onError) {
                                  // Strip the leading slash, since not used internally.
                                  var path = options.filePath.substring(1);
                                
                                  var readParameters = s3fs.parameters({
                                Severity: Minor
                                Found in s3fs/js/events.js - About 1 hr to fix

                                  Function request has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  WebDAVClient.prototype.request = function(verb, url, headers, data, responseType,
                                    onSuccess, onError) {
                                      var xhr = new XMLHttpRequest();
                                  
                                      var processBody = function() {
                                  Severity: Minor
                                  Found in webdavfs/js/client.js - About 1 hr to fix

                                    Function onDeleteEntryRequested has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    var onDeleteEntryRequested = function(options, onSuccess, onError) {
                                      if (!options.entryPath) {
                                        onError('INVALID_OPERATION');
                                        return;
                                      }
                                    Severity: Minor
                                    Found in webdavfs/js/events.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 onTruncateRequested has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    var onTruncateRequested = function(options, onSuccess, onError) {
                                      if (!options.filePath) {
                                        onError('INVALID_OPERATION');
                                        return;
                                      }
                                    Severity: Minor
                                    Found in webdavfs/js/events.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language