adobe/brackets

View on GitHub
src/project/FileTreeViewModel.js

Summary

Maintainability
D
2 days
Test Coverage

File FileTreeViewModel.js has 613 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2014 - present Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
Severity: Major
Found in src/project/FileTreeViewModel.js - About 1 day to fix

    Function _createIntermediateDirectories has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _createIntermediateDirectories(treeData, path) {
            var objectPath = [],
                result = {
                    objectPath: objectPath,
                    treeData: treeData
    Severity: Minor
    Found in src/project/FileTreeViewModel.js - About 1 hr to fix

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

          function _setDirectoryOpen(treeData, path, open) {
              var objectPath = _filePathToObjectPath(treeData, path),
                  directory = treeData.getIn(objectPath);
      
              if (!objectPath) {
      Severity: Minor
      Found in src/project/FileTreeViewModel.js - About 1 hr to fix

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

            function _createPlaceholder(treeData, basedir, name, isFolder, options) {
                options = options || {};
                var parentPath = _filePathToObjectPath(treeData, basedir);
        
                if (!parentPath) {
        Severity: Minor
        Found in src/project/FileTreeViewModel.js - About 1 hr to fix

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

              function _isFilePathVisible(treeData, path) {
                  if (path === null) {
                      return null;
                  } else if (path === "") {
                      return true;
          Severity: Minor
          Found in src/project/FileTreeViewModel.js - About 1 hr to fix

            Function _mergeContentsIntoChildren has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function _mergeContentsIntoChildren(children, contents) {
            
                    // We keep track of the names we've seen among the current directory entries to make
                    // it easy to spot the names that we *haven't* seen (in other words, files that have
                    // been deleted).
            Severity: Minor
            Found in src/project/FileTreeViewModel.js - About 1 hr to fix

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

                  function _filePathToObjectPath(treeData, path) {
                      if (path === null) {
                          return null;
                      } else if (path === "") {
                          return [];
              Severity: Minor
              Found in src/project/FileTreeViewModel.js - About 1 hr to fix

                Function renameItem has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    FileTreeViewModel.prototype.renameItem = function (oldPath, newPath) {
                        var treeData = this._treeData,
                            oldObjectPath = _filePathToObjectPath(treeData, oldPath),
                            newDirectoryPath = FileUtils.getParentPath(newPath),
                            newObjectPath = _filePathToObjectPath(treeData, newDirectoryPath);
                Severity: Minor
                Found in src/project/FileTreeViewModel.js - About 1 hr to fix

                  Function setDirectoryContents has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      FileTreeViewModel.prototype.setDirectoryContents = function (path, contents) {
                          path = FileUtils.stripTrailingSlash(path);
                  
                          var intermediate = _createIntermediateDirectories(this._treeData, path),
                              objectPath = intermediate.objectPath,
                  Severity: Minor
                  Found in src/project/FileTreeViewModel.js - About 1 hr to fix

                    Function _createPlaceholder has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        function _createPlaceholder(treeData, basedir, name, isFolder, options) {
                    Severity: Minor
                    Found in src/project/FileTreeViewModel.js - About 35 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                          return false;
                      Severity: Major
                      Found in src/project/FileTreeViewModel.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return true;
                        Severity: Major
                        Found in src/project/FileTreeViewModel.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return result;
                          Severity: Major
                          Found in src/project/FileTreeViewModel.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return {
                                        needsLoading: false,
                                        treeData: treeData
                                    };
                            Severity: Major
                            Found in src/project/FileTreeViewModel.js - About 30 mins to fix

                              There are no issues that match your filters.

                              Category
                              Status