adobe/brackets

View on GitHub
src/editor/CodeHintList.js

Summary

Maintainability
F
5 days
Test Coverage

Function _keydownHook has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    CodeHintList.prototype._keydownHook = function (event, isFakeKeydown) {
        var keyCode,
            self = this;

        // positive distance rotates down; negative distance rotates up
Severity: Major
Found in src/editor/CodeHintList.js - About 3 hrs to fix

    File CodeHintList.js has 289 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/editor/CodeHintList.js - About 2 hrs to fix

      Function _buildListView has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          CodeHintList.prototype._buildListView = function (hintObj) {
              var self            = this,
                  match           = hintObj.match,
                  selectInitial   = hintObj.selectInitial,
                  view            = { hints: [] },
      Severity: Major
      Found in src/editor/CodeHintList.js - About 2 hrs to fix

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

            CodeHintList.prototype._calcHintListLocation = function () {
                var cursor      = this.editor._codeMirror.cursorCoords(),
                    posTop      = cursor.bottom,
                    posLeft     = cursor.left,
                    textHeight  = this.editor.getTextHeight(),
        Severity: Minor
        Found in src/editor/CodeHintList.js - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                          return false;
          Severity: Major
          Found in src/editor/CodeHintList.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return true;
            Severity: Major
            Found in src/editor/CodeHintList.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return false;
              Severity: Major
              Found in src/editor/CodeHintList.js - About 30 mins to fix

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

                            if (self.selectedIndex < 0) {
                                // set the initial selection
                                pos = (distance > 0) ? distance - 1 : len - 1;
                
                            } else {
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 7 hrs to fix
                src/widgets/InlineMenu.js on lines 283..305

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

                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

                    CodeHintList.prototype.open = function (hintObj) {
                        Menus.closeAll();
                        this._buildListView(hintObj);
                
                        if (this.hints.length) {
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 7 hrs to fix
                src/widgets/InlineMenu.js on lines 397..414

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

                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 _itemsPerPage() {
                            var itemsPerPage = 1,
                                $items = self.$hintMenu.find("li"),
                                $view = self.$hintMenu.find("ul.dropdown-menu"),
                                itemHeight;
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 6 hrs to fix
                src/widgets/InlineMenu.js on lines 311..327

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

                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

                    CodeHintList.prototype.close = function () {
                        this.opened = false;
                
                        if (this.$hintMenu) {
                            this.$hintMenu.removeClass("open");
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 3 hrs to fix
                src/widgets/InlineMenu.js on lines 432..442

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

                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

                    CodeHintList.prototype.isOpen = function () {
                        // We don't get a notification when the dropdown closes. The best
                        // we can do is keep an "opened" flag and check to see if we
                        // still have the "open" class applied.
                        if (this.opened && !this.$hintMenu.hasClass("open")) {
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 2 hrs to fix
                src/widgets/InlineMenu.js on lines 381..390

                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

                            } else if (event.shiftKey &&
                                    (event.keyCode === KeyEvent.DOM_VK_UP ||
                                     event.keyCode === KeyEvent.DOM_VK_DOWN ||
                                     event.keyCode === KeyEvent.DOM_VK_PAGE_UP ||
                                     event.keyCode === KeyEvent.DOM_VK_PAGE_DOWN)) {
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 1 hr to fix
                src/widgets/InlineMenu.js on lines 344..366

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

                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

                        return (keyCode === KeyEvent.DOM_VK_UP || keyCode === KeyEvent.DOM_VK_DOWN ||
                                keyCode === KeyEvent.DOM_VK_PAGE_UP || keyCode === KeyEvent.DOM_VK_PAGE_DOWN ||
                                keyCode === KeyEvent.DOM_VK_RETURN ||
                                keyCode === KeyEvent.DOM_VK_CONTROL ||
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 1 hr to fix
                src/widgets/InlineMenu.js on lines 262..265

                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

                            $ul.on("click", "li", function (e) {
                                // Don't let the click propagate upward (otherwise it will
                                // hit the close handler in bootstrap-dropdown).
                                e.stopPropagation();
                                if (self.handleSelect) {
                Severity: Major
                Found in src/editor/CodeHintList.js and 1 other location - About 1 hr to fix
                src/widgets/InlineMenu.js on lines 191..198

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

                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 (this.selectedIndex !== -1) {
                            $(items[this.selectedIndex]).find("a").removeClass("highlight");
                        }
                Severity: Minor
                Found in src/editor/CodeHintList.js and 1 other location - About 45 mins to fix
                src/widgets/InlineMenu.js on lines 124..126

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

                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