rooey/chromeos-filesystem-onedrive

View on GitHub
src/scripts/onedrive_fs.js

Summary

Maintainability
D
3 days
Test Coverage

File onedrive_fs.js has 501 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

// Constants
// Use set DEBUG_ENABLED to true to enable verbose logging (alpha builds)
const DEBUG_ENABLED = true;
Severity: Major
Found in src/scripts/onedrive_fs.js - About 1 day to fix
  • Create a ticket

    OneDriveFS has 43 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OneDriveFS {
    
        // Constructor
    
        constructor() {
    Severity: Minor
    Found in src/scripts/onedrive_fs.js - About 5 hrs to fix
    • Create a ticket

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

          assignEventHandlers() {
              chrome.alarms.onAlarm.addListener(alarm => {
                  if (alarm.name === 'onedrive_alarm') {
                      this.onAlarm(alarm);
                  }
      Severity: Major
      Found in src/scripts/onedrive_fs.js - About 2 hrs to fix
      • Create a ticket

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

            mount(successCallback, errorCallback) {
                const onedriveClient = new OneDriveClient(this);
                onedriveClient.authorize(() => {
                    onedriveClient.getDriveData((driveInfo) => {
                        onedriveClient.getUserInfo((userInfo) => {
        Severity: Minor
        Found in src/scripts/onedrive_fs.js - About 1 hr to fix
        • Create a ticket

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

              watchDirectory(fileSystemId, onedriveClient, entryPath) {
                  this.useOptions('useWatcher', use => {
                      if (!use) {
                          return;
                      }
          Severity: Minor
          Found in src/scripts/onedrive_fs.js - About 1 hr to fix
          • Create a ticket

            Function createEventHandler has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                createEventHandler(callback) {
                    return (options, successCallback, errorCallback) => {
                        const fileSystemId = options.fileSystemId;
                        const onedriveClient = this.getOneDriveClient(fileSystemId);
                        if (!onedriveClient) {
            Severity: Minor
            Found in src/scripts/onedrive_fs.js - About 1 hr to fix
            • Create a ticket

              Unnecessary semicolon.
              Open

                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

              Unnecessary semicolon.
              Open

                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

              Unnecessary semicolon.
              Open

                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

              Unnecessary semicolon.
              Open

                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

              Unnecessary semicolon.
              Open

                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

              Unnecessary semicolon.
              Open

                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

              Unnecessary semicolon.
              Open

              };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

              Unnecessary semicolon.
              Open

                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js by eslint

              disallow unnecessary semicolons (no-extra-semi)

              Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

              Rule Details

              This rule disallows unnecessary semicolons.

              Examples of incorrect code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;;
              
              function foo() {
                  // code
              };

              Examples of correct code for this rule:

              /*eslint no-extra-semi: "error"*/
              
              var x = 5;
              
              var foo = function() {
                  // code
              };

              When Not To Use It

              If you intentionally use extra semicolons then you can disable this rule.

              Related Rules

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

                  useOptions(options, callback) {
                      chrome.storage.local.get('settings', items => {
                          const settings = items.settings || {};
                          callback(settings[options] || false);
                      });
              Severity: Major
              Found in src/scripts/onedrive_fs.js and 1 other location - About 1 hr to fix
              src/scripts/http_fetcher.js on lines 120..125

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

              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

                  onAddWatcherRequested(onedriveClient, options, successCallback, _errorCallback) {
                      const watchers = this.getWatchers(options.fileSystemId);
                      watchers.add(options.entryPath);
                      successCallback();
                  }
              Severity: Minor
              Found in src/scripts/onedrive_fs.js and 1 other location - About 50 mins to fix
              src/scripts/onedrive_fs.js on lines 189..193

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                  onRemoveWatcherRequested(onedriveClient, options, successCallback, _errorCallback) {
                      const watchers = this.getWatchers(options.fileSystemId);
                      watchers.delete(options.entryPath);
                      successCallback();
                  }
              Severity: Minor
              Found in src/scripts/onedrive_fs.js and 1 other location - About 50 mins to fix
              src/scripts/onedrive_fs.js on lines 183..187

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                  writeLog(messageType, message, payload) {
                      if ((messageType === 'debug') && (DEBUG_ENABLED !==true)) return;
                      console.log('[' + messageType + '] ' + message, payload);
                      return;
                  };
              Severity: Minor
              Found in src/scripts/onedrive_fs.js and 1 other location - About 35 mins to fix
              src/scripts/http_fetcher.js on lines 88..92

              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