src/project/FileTreeViewModel.js
File FileTreeViewModel.js
has 613 lines of code (exceeds 250 allowed). Consider refactoring. Open
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"),
Function _createIntermediateDirectories
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _createIntermediateDirectories(treeData, path) {
var objectPath = [],
result = {
objectPath: objectPath,
treeData: treeData
Function _setDirectoryOpen
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _setDirectoryOpen(treeData, path, open) {
var objectPath = _filePathToObjectPath(treeData, path),
directory = treeData.getIn(objectPath);
if (!objectPath) {
Function _createPlaceholder
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _createPlaceholder(treeData, basedir, name, isFolder, options) {
options = options || {};
var parentPath = _filePathToObjectPath(treeData, basedir);
if (!parentPath) {
Function _isFilePathVisible
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _isFilePathVisible(treeData, path) {
if (path === null) {
return null;
} else if (path === "") {
return true;
Function _mergeContentsIntoChildren
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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).
Function _filePathToObjectPath
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _filePathToObjectPath(treeData, path) {
if (path === null) {
return null;
} else if (path === "") {
return [];
Function renameItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
FileTreeViewModel.prototype.renameItem = function (oldPath, newPath) {
var treeData = this._treeData,
oldObjectPath = _filePathToObjectPath(treeData, oldPath),
newDirectoryPath = FileUtils.getParentPath(newPath),
newObjectPath = _filePathToObjectPath(treeData, newDirectoryPath);
Function setDirectoryContents
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
FileTreeViewModel.prototype.setDirectoryContents = function (path, contents) {
path = FileUtils.stripTrailingSlash(path);
var intermediate = _createIntermediateDirectories(this._treeData, path),
objectPath = intermediate.objectPath,
Function _createPlaceholder
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function _createPlaceholder(treeData, basedir, name, isFolder, options) {
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return result;
Avoid too many return
statements within this function. Open
Open
return {
needsLoading: false,
treeData: treeData
};