adobe/brackets

View on GitHub

Showing 3,294 of 3,294 total issues

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

jQuery.ajaxSetup({
    accepts: {
        script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
    },
    contents: {
Severity: Major
Found in src/thirdparty/jquery-2.1.3.js and 1 other location - About 1 hr to fix
src/extensions/default/JavaScriptQuickEdit/unittest-files/jquery-ui/jquery-1.7.2.js on lines 8050..8063

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

Function setInlineWidgetHeight has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Editor.prototype.setInlineWidgetHeight = function (inlineWidget, height, ensureVisible) {
        var self = this,
            node = inlineWidget.htmlContent,
            oldHeight = (node && $(node).height()) || 0,
            changed = (oldHeight !== height),
Severity: Minor
Found in src/editor/Editor.js - About 1 hr to fix

    Function _handleMouseEnterOrExitScaleSticker has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ImageView.prototype._handleMouseEnterOrExitScaleSticker = function (offsetX, offsetY) {
            var imagePos       = this.$imagePreview.position(),
                scaleDivPos    = this.$imageScale.position(),
                imgWidth       = this.$imagePreview.width(),
                imgHeight      = this.$imagePreview.height(),
    Severity: Minor
    Found in src/editor/ImageViewer.js - About 1 hr to fix

      Function shake has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      $.effects.effect.shake = function( o, done ) {
      
          var el = $( this ),
              props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
              mode = $.effects.setMode( el, o.mode || "effect" ),

        Function conststatement has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                var conststatement = stmt('const', function (prefix) {
                    var id, name, value;
        
                    this.first = [];
                    for (;;) {

          Function varstatement has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var varstatement = stmt('var', function (prefix) {
                  // JavaScript does not have block scope. It only has function scope. So,
                  // declaring a variable in a block can have unexpected consequences.
                  var id, name, value;
          
          

            Function _makeResizable has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _makeResizable: function( handles ) {
                    handles = (handles === undefined ? this.options.resizable : handles);
                    var that = this,
                        options = this.options,
                        // .ui-resizable has position: relative defined in the stylesheet

              Function directives has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function directives() {
                      var i, p, pn;
              
                      for (;;) {
                          if (nexttoken.id === "(string)") {

                Function load has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    load: function( index, event ) {
                        index = this._getIndex( index );
                        var that = this,
                            tab = this.tabs.eq( index ),
                            anchor = tab.find( ".ui-tabs-anchor" ),

                  Function add has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          add: function( url, label, index ) {
                              if ( index === undefined ) {
                                  index = this.anchors.length;
                              }
                  
                  

                    Function scale has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    $.effects.effect.scale = function( o, done ) {
                    
                        // Create element
                        var el = $( this ),
                            options = $.extend( true, {}, o ),

                      Function writeFile has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function writeFile(path, data, options, callback) {
                              var encoding = options.encoding || "utf8",
                                  preserveBOM = options.preserveBOM;
                      
                              function _finishWrite(created) {
                      Severity: Minor
                      Found in src/filesystem/impls/appshell/AppshellFileSystem.js - About 1 hr to fix

                        Function loadMetadata has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function loadMetadata(folder) {
                                var packageJSONFile = FileSystem.getFileForPath(folder + "/package.json"),
                                    disabledFile = FileSystem.getFileForPath(folder + "/.disabled"),
                                    baseName = FileUtils.getBaseName(folder),
                                    result = new $.Deferred(),
                        Severity: Minor
                        Found in src/utils/ExtensionUtils.js - About 1 hr to fix

                          Function _updateFromPrefs has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function _updateFromPrefs(pref) {
                                  var newMapping = PreferencesManager.get(pref),
                                      newNames = Object.keys(newMapping),
                                      state = _prefState[pref],
                                      last = state.last,
                          Severity: Minor
                          Found in src/language/LanguageManager.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (isBlockComment) {
                                            // Save the initial position to start searching for the suffix from here
                                            initialPos = _.cloneDeep(ctx.pos);
                            
                                            // Find the position of the start of the prefix
                            Severity: Critical
                            Found in src/editor/EditorCommandHandlers.js - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if ( ( ( $target[0].id != $.datepicker._mainDivId &&
                                              $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
                                              !$target.hasClass($.datepicker.markerClassName) &&
                                              !$target.closest("." + $.datepicker._triggerClass).length &&
                                              $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||

                                Consider simplifying this complex logical expression.
                                Open

                                        if (this.floating && horizontalDirection) {
                                            return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
                                        } else {
                                            return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
                                        }

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if(!(/^(document|window|parent)$/).test(o.containment)) {
                                              var ce = $(o.containment)[0];
                                              var co = $(o.containment).offset();
                                              var over = ($(ce).css("overflow") != 'hidden');
                                  
                                  

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

                                                if (!_.isEqual(section[id], value)) {
                                                    if (value === undefined) {
                                                        delete section[id];
                                                    } else {
                                                        section[id] = _.cloneDeep(value);
                                    Severity: Major
                                    Found in src/preferences/PreferencesBase.js and 1 other location - About 1 hr to fix
                                    src/preferences/PreferencesBase.js on lines 941..948

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

                                    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 _attachListners() {
                                            MainViewManager.on("workingSetMove.pane-first-pane", _handleWorkingSetMove);
                                            MainViewManager.on("currentFileChange", handleCurrentFileChange);
                                            MainViewManager.on("paneDestroy", _handlePaneMerge);
                                            EditorManager.on("activeEditorChange", _handleActiveEditorChange);
                                    Severity: Major
                                    Found in src/extensions/default/NavigationAndHistory/main.js and 1 other location - About 1 hr to fix
                                    src/extensions/default/NavigationAndHistory/main.js on lines 806..812

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

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language