adobe/brackets

View on GitHub
src/filesystem/FileSystem.js

Summary

Maintainability
D
2 days
Test Coverage

File FileSystem.js has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2013 - 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: Minor
Found in src/filesystem/FileSystem.js - About 7 hrs to fix

    Function _watchOrUnwatchEntry has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        FileSystem.prototype._watchOrUnwatchEntry = function (entry, watchedRoot, callback, shouldWatch) {
            var impl = this._impl,
                recursiveWatch = impl.recursiveWatch,
                commandName = shouldWatch ? "watchPath" : "unwatchPath",
                filterGlobs = watchedRoot.filterGlobs;
    Severity: Minor
    Found in src/filesystem/FileSystem.js - About 1 hr to fix

      Function _handleDirectoryChange has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          FileSystem.prototype._handleDirectoryChange = function (directory, callback) {
              var oldContents = directory._contents;
      
              directory._clearCachedData();
              directory.getContents(function (err, contents) {
      Severity: Minor
      Found in src/filesystem/FileSystem.js - About 1 hr to fix

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

            FileSystem.prototype.watch = function (entry, filter, filterGlobs, callback) {
                // make filterGlobs an optional argument to stay backwards compatible
                if (typeof callback === "undefined" && typeof filterGlobs === "function") {
                    callback = filterGlobs;
                    filterGlobs = null;
        Severity: Minor
        Found in src/filesystem/FileSystem.js - About 1 hr to fix

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

              FileSystem.prototype.resolve = function (path, callback) {
                  var normalizedPath = this._normalizePath(path, false),
                      item = this._index.getEntry(normalizedPath);
          
                  if (!item) {
          Severity: Minor
          Found in src/filesystem/FileSystem.js - About 1 hr to fix

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

                FileSystem.prototype._handleExternalChange = function (path, stat) {
            
                    if (!path) {
                        // This is a "wholesale" change event; clear all caches
                        this._index.visitAll(function (entry) {
            Severity: Minor
            Found in src/filesystem/FileSystem.js - About 1 hr to fix

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

                  FileSystem.prototype._normalizePath = function (path, isDirectory) {
              
                      if (!FileSystem.isAbsolutePath(path)) {
                          throw new Error("Paths must be absolute: '" + path + "'");  // expect only absolute paths
                      }
              Severity: Minor
              Found in src/filesystem/FileSystem.js - About 1 hr to fix

                Function showOpenDialog has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    FileSystem.prototype.showOpenDialog = function (allowMultipleSelection,
                                            chooseDirectories,
                                            title,
                                            initialPath,
                                            fileTypes,
                Severity: Minor
                Found in src/filesystem/FileSystem.js - About 45 mins to fix

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

                      FileSystem.prototype.close = function () {
                          this._impl.unwatchAll();
                          this._index.clear();
                      };
                  Severity: Minor
                  Found in src/filesystem/FileSystem.js and 1 other location - About 50 mins to fix
                  src/editor/ImageViewer.js on lines 276..279

                  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

                          if (watchingParentRoot &&
                                  (watchingParentRoot.status === WatchedRoot.STARTING ||
                                   watchingParentRoot.status === WatchedRoot.ACTIVE)) {
                              callback("A parent of this root is already watched");
                              return;
                  Severity: Minor
                  Found in src/filesystem/FileSystem.js and 1 other location - About 35 mins to fix
                  src/filesystem/FileSystem.js on lines 950..955

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

                  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

                          if (watchingChildRoot &&
                                  (watchingChildRoot.status === WatchedRoot.STARTING ||
                                   watchingChildRoot.status === WatchedRoot.ACTIVE)) {
                              callback("A child of this root is already watched");
                              return;
                  Severity: Minor
                  Found in src/filesystem/FileSystem.js and 1 other location - About 35 mins to fix
                  src/filesystem/FileSystem.js on lines 936..941

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

                  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

                      FileSystem.prototype.showSaveDialog = function (title, initialPath, proposedNewFilename, callback) {
                          this._impl.showSaveDialog(title, initialPath, proposedNewFilename, callback);
                      };
                  Severity: Minor
                  Found in src/filesystem/FileSystem.js and 1 other location - About 35 mins to fix
                  src/project/ProjectModel.js on lines 348..350

                  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