adobe/brackets

View on GitHub
src/LiveDevelopment/LiveDevMultiBrowser.js

Summary

Maintainability
F
6 days
Test Coverage

File LiveDevMultiBrowser.js has 459 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2012 - 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/LiveDevelopment/LiveDevMultiBrowser.js - About 7 hrs to fix

    Function _getInitialDocFromCurrent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _getInitialDocFromCurrent() {
            var doc = DocumentManager.getCurrentDocument(),
                refPath,
                i;
    
    
    Severity: Major
    Found in src/LiveDevelopment/LiveDevMultiBrowser.js - About 2 hrs to fix

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

          function _open(doc) {
              if (doc && _liveDocument && doc === _liveDocument.doc) {
                  if (_server) {
                      // Launch the URL in the browser. If it's the first one to connect back to us,
                      // our status will transition to ACTIVE once it does so.
      Severity: Minor
      Found in src/LiveDevelopment/LiveDevMultiBrowser.js - About 1 hr to fix

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

            function _prepareServer(doc) {
                var deferred = new $.Deferred(),
                    showBaseUrlPrompt = false;
        
                _server = LiveDevServerManager.getServer(doc.file.fullPath);
        Severity: Minor
        Found in src/LiveDevelopment/LiveDevMultiBrowser.js - About 1 hr to fix

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

                  ProjectManager.getAllFiles().done(function (allFiles) {
                      var projectRoot = ProjectManager.getProjectRoot().fullPath,
                          containingFolder,
                          indexFileFound = false,
                          stillInProjectTree = true;
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 2 days to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 709..766

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

          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

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

                  if (showBaseUrlPrompt) {
                      // Prompt for a base URL
                      PreferencesDialogs.showProjectPreferencesDialog("", Strings.LIVE_DEV_NEED_BASEURL_MESSAGE)
                          .done(function (id) {
                              if (id === Dialogs.DIALOG_BTN_OK && ProjectManager.getBaseUrl()) {
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 1 day to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 1282..1308

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

          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

              function _closeDocuments() {
                  if (_liveDocument) {
                      _closeDocument(_liveDocument);
                      _liveDocument = undefined;
                  }
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 3 hrs to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 388..403

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

          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

              function _setStatus(status, closeReason) {
                  // Don't send a notification when the status didn't actually change
                  if (status === exports.status) {
                      return;
                  }
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 1 hr to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 333..343

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

          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

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

                  if (doc) {
                      refPath = doc.file.fullPath;
                      if (LiveDevelopmentUtils.isStaticHtmlFileExt(refPath) || LiveDevelopmentUtils.isServerHtmlFileExt(refPath)) {
                          return new $.Deferred().resolve(doc);
                      }
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 1 hr to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 697..702

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

          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

              function _docIsOutOfSync(doc) {
                  var liveDoc = _server && _server.get(doc.file.fullPath),
                      isLiveEditingEnabled = liveDoc && liveDoc.isLiveEditingEnabled();
          
                  return doc.isDirty && !isLiveEditingEnabled;
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 1 hr to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 465..470

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

          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

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

                  var absolutePath            = doc.file.fullPath,
                      liveDocument            = absolutePath && _server.get(absolutePath),
                      liveEditingEnabled      = liveDocument && liveDocument.isLiveEditingEnabled  && liveDocument.isLiveEditingEnabled();
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 1 hr to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 1473..1475

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

          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

              function showHighlight() {
                  var doc = getLiveDocForEditor(EditorManager.getActiveEditor());
          
                  if (doc && doc.updateHighlight) {
                      doc.updateHighlight();
          Severity: Major
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 1 hr to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 1401..1407

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

          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

              function _createLiveDocumentForFrame(doc) {
                  // create live document
                  doc._ensureMasterEditor();
                  _liveDocument = _createLiveDocument(doc, doc._masterEditor);
                  _server.add(_liveDocument);
          Severity: Minor
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 50 mins to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 432..437

          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

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

              function getCurrentProjectServerConfig() {
                  return {
                      baseUrl: ProjectManager.getBaseUrl(),
                      pathResolver: ProjectManager.makeProjectRelativeIfPossible,
                      root: ProjectManager.getProjectRoot().fullPath
          Severity: Minor
          Found in src/LiveDevelopment/LiveDevMultiBrowser.js and 1 other location - About 30 mins to fix
          src/LiveDevelopment/LiveDevelopment.js on lines 1313..1319

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

          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