adobe/brackets

View on GitHub

Showing 3,294 of 3,294 total issues

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

    Menu.prototype.closeSubMenu = function() {
        if (this.openSubMenu) {
            this.openSubMenu.close();
            this.openSubMenu = null;
        }
Severity: Major
Found in src/command/Menus.js and 1 other location - About 1 hr to fix
src/search/QuickSearchField.js on lines 244..249

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

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

    QuickSearchField.prototype._closeDropdown = function () {
        if (this._$dropdown) {
            this._$dropdown.remove();
            this._$dropdown = null;
        }
Severity: Major
Found in src/search/QuickSearchField.js and 1 other location - About 1 hr to fix
src/command/Menus.js on lines 897..902

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

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 filterWithQueryAndMatcher has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function filterWithQueryAndMatcher(hints, matcher) {
            var matchResults = $.map(hints, function (hint) {
                var searchResult = matcher.match(hint.value, query);
                if (searchResult) {
                    searchResult.value = hint.value;
Severity: Minor
Found in src/JSUtils/Session.js - About 1 hr to fix

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

        function _onActiveEditorChange(event, current, previous) {
            if (previous) {
                previous.off(".statusbar");
                previous.document.off(".statusbar");
                previous.document.releaseRef();
    Severity: Minor
    Found in src/editor/EditorStatusBar.js - About 1 hr to fix

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

          function removeMenu(id) {
              var menu,
                  commandID = "";
      
              if (!id) {
      Severity: Minor
      Found in src/command/Menus.js - About 1 hr to fix

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

            function formatHints(hints, query) {
        
                var hasMetadata = hints.some(function (token) {
                    return token.type || token.description;
                });
        Severity: Minor
        Found in src/extensions/default/PrefsCodeHints/main.js - About 1 hr to fix

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

              function _send(method, signature, varargs) {
                  if (!_socket) {
                      console.log("You must connect to the WebSocket before sending messages.");
          
                      // FUTURE: Our current implementation closes and re-opens an inspector connection whenever
          Severity: Minor
          Found in src/LiveDevelopment/Inspector/Inspector.js - About 1 hr to fix

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

                function positionPreview(editor, xpos, ypos, ybot) {
                    var previewWidth  = $previewContainer.outerWidth(),
                        top           = ypos - $previewContainer.outerHeight() - POINTER_HEIGHT,
                        left          = xpos - previewWidth / 2,
                        elementRect = {
            Severity: Minor
            Found in src/extensions/default/QuickView/main.js - About 1 hr to fix

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

                  StaticServer.prototype.readyToServe = function () {
                      var self = this;
                      var deferred = new $.Deferred();
              
                      function sanitizePort(port) {
              Severity: Minor
              Found in src/extensions/default/StaticServer/StaticServer.js - About 1 hr to fix

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

                        onClose: function () {
                            var body = window.document.getElementsByTagName("body")[0],
                                overlay = window.document.createElement("div"),
                                background = window.document.createElement("div"),
                                status = window.document.createElement("div");

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

                      function handlePointMove(e, x, y) {
                          var self = e.target,
                              bezierEditor = self.bezierEditor;
                  
                          // Helper function to redraw curve

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

                        _possibleChars: function (format) {
                            var chars = '';
                            var literal = false;
                            // Check whether a format character is doubled
                            var lookAhead = function(match) {

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

                      var serverOptions = function () {
                              return new Promise(function (resolve, reject) {
                                  var server = net.createServer(function (socket) {
                                      console.log('PHP process connected');
                                      socket.on('end', function () {
                      Severity: Minor
                      Found in src/extensions/default/PhpTooling/client.js - About 1 hr to fix

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

                            InlineTimingFunctionEditor.prototype.getCurrentRange = function () {
                                var start, end;
                        
                                start = this._startBookmark.find();
                                if (!start) {

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

                              function indentFold(cm, start) {
                                  var lineText = cm.getLine(start.line), tabSize = cm.getOption("tabSize");
                          
                                  var lineIndent = cols(lineText, null, tabSize), collapsible = false, lineCount = cm.lineCount();
                                  var token = cm.getTokenAt(pos(start.line, lineIndent + 1));
                          Severity: Minor
                          Found in src/extensions/default/CodeFolding/foldhelpers/indentFold.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 BezierCurveEditor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function BezierCurveEditor($parent, bezierCurve, callback) {
                                      // Create the DOM structure, filling in localized strings via Mustache
                                      this.$element = $(Mustache.render(BezierCurveEditorTemplate, Strings));
                                      $parent.append(this.$element);
                              
                              

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

                                    _attachHandlers: function(inst) {
                                        var stepMonths = this._get(inst, 'stepMonths');
                                        var id = '#' + inst.id;
                                        inst.dpDiv.find('[data-handler]').map(function () {
                                            var handler = {

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

                                          var offsetString = function(offset) {
                                              try {
                                                  return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
                                                      offset, $.datepicker._getFormatConfig(inst));
                                              }

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

                                        _hideDatepicker: function(input) {
                                            var inst = this._curInst;
                                            if (!inst || (input && inst != $.data(input, PROP_NAME)))
                                                return;
                                            if (this._datepickerShowing) {
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language