adobe/brackets

View on GitHub
src/extensions/default/AutoUpdate/main.js

Summary

Maintainability
F
4 days
Test Coverage

File main.js has 718 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2018 - 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/extensions/default/AutoUpdate/main.js - About 1 day to fix

    Function handleValidationStatus has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function handleValidationStatus(statusObj) {
            enableCheckForUpdateEntry(true);
            UpdateStatus.cleanUpdateStatus();
    
            if (statusObj.valid) {
    Severity: Major
    Found in src/extensions/default/AutoUpdate/main.js - About 3 hrs to fix

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

          function initiateUpdateProcess(formattedInstallerPath, formattedLogFilePath, installStatusFilePath) {
      
              // Get additional update parameters on Mac : installDir, appName, and updateDir
              function getAdditionalParams() {
                  var retval = {};
      Severity: Minor
      Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

        Function initiateAutoUpdate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function initiateAutoUpdate(updateParams) {
                _updateParams = updateParams;
                downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS;
        
                initializeState()
        Severity: Minor
        Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

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

                      var statusValidFn = function () {
          
                          // Restart button click handler
                          var restartBtnClicked = function () {
                              HealthLogger.sendAnalyticsData(
          Severity: Minor
          Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

            Function checkUpdateStatus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function checkUpdateStatus() {
                    var filesToCache = ['.logs'],
                        downloadCompleted = updateJsonHandler.get("downloadCompleted"),
                        updateInitiatedInPrevSession = updateJsonHandler.get("updateInitiatedInPrevSession");
            
            
            Severity: Minor
            Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

              Function handleSafeToDownload has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function handleSafeToDownload() {
                      var downloadFn = function () {
                          if (isFirstIterationDownload()) {
                              // For the first iteration of download, show download
                              //status info in Status bar, and pass download to node
              Severity: Minor
              Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

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

                    function _updateProcessHandler(updates) {
                
                            if (!updates) {
                                console.warn("AutoUpdate : updates information not available.");
                                return;
                Severity: Minor
                Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

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

                      function handleDownloadFailure(message) {
                          console.log("AutoUpdate : Download of latest installer failed in Attempt " +
                              (MAX_DOWNLOAD_ATTEMPTS - downloadAttemptsRemaining) + ".\n Reason : " + message);
                  
                          if (downloadAttemptsRemaining) {
                  Severity: Minor
                  Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

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

                            var updateFn = function () {
                                var infoObj = {
                                    installerPath: formattedInstallerPath,
                                    logFilePath: formattedLogFilePath,
                                    installStatusFilePath: installStatusFilePath
                    Severity: Minor
                    Found in src/extensions/default/AutoUpdate/main.js - About 1 hr to fix

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

                          function getFunctionArgs(args) {
                              if (args.length > 1) {
                                  var fnArgs = new Array(args.length - 1),
                                      i;
                      
                      
                      Severity: Major
                      Found in src/extensions/default/AutoUpdate/main.js and 1 other location - About 3 hrs to fix
                      src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js on lines 75..85

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

                      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(!isAutoUpdateInitiated) {
                                      isAutoUpdateInitiated = true;
                                      updateJsonHandler.refresh()
                                          .done(function() {
                                              setUpdateStateInJSON('downloadCompleted', true)
                      Severity: Major
                      Found in src/extensions/default/AutoUpdate/main.js and 1 other location - About 2 hrs to fix
                      src/extensions/default/AutoUpdate/main.js on lines 681..691

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

                      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(!isAutoUpdateInitiated) {
                                  isAutoUpdateInitiated = true;
                                  updateJsonHandler.refresh()
                                      .done(function() {
                                          setUpdateStateInJSON('downloadCompleted', false)
                      Severity: Major
                      Found in src/extensions/default/AutoUpdate/main.js and 1 other location - About 2 hrs to fix
                      src/extensions/default/AutoUpdate/main.js on lines 959..969

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

                      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