rooey/chromeos-filesystem-onedrive

View on GitHub

Showing 12 of 55 total issues

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 handleError has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          handleError(error, textStatus, errorThrown) {
              const status = Number(error.status);
              if (status === 404 || status === 409) {
                  console.debug(error);
                  this.errorCallback_('NOT_FOUND');
      Severity: Minor
      Found in src/scripts/http_fetcher.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 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 background has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const background = () => {
            if (!chrome.fileSystemProvider) {
                console.log('There is no chrome.fileSystemProvider API. See you on ChromeOS!');
                return;
            }
        Severity: Major
        Found in src/scripts/background.js - About 2 hrs to fix
        • Create a ticket

          Function handleError has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              handleError(error, textStatus, errorThrown) {
                  const status = Number(error.status);
                  if (status === 404 || status === 409) {
                      console.debug(error);
                      this.errorCallback_('NOT_FOUND');
          Severity: Minor
          Found in src/scripts/http_fetcher.js - About 1 hr 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

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

                      MetadataCache.prototype.get = function(entryPath) {
                          if (entryPath === "/") {
                              return {
                                  needFetch: true,
                                  exists: true
                  Severity: Minor
                  Found in src/scripts/metadata_cache.js - About 1 hr to fix
                  • Create a ticket

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

                        onClickedBtnMount(evt) {
                            const btnMount = document.querySelector('#btnMount');
                            evt.preventDefault();
                            btnMount.setAttribute('disabled', 'true');
                            $.toast({
                    Severity: Minor
                    Found in src/scripts/window.js - About 1 hr to fix
                    • Create a ticket

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

                          assignEventHandlers() {
                              const btnMount = document.querySelector('#btnMount');
                              btnMount.addEventListener('click', e => {
                                  this.onClickedBtnMount(e);
                              });
                      Severity: Minor
                      Found in src/scripts/window.js - About 1 hr to fix
                      • Create a ticket
                        Severity
                        Category
                        Status
                        Source
                        Language