ivaynberg/select2

View on GitHub

Showing 58 of 136 total issues

Function query has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tokenizer.prototype.query = function (decorated, params, callback) {
    var self = this;

    function createAndSelect (data) {
      // Normalize the data object so we can use it for checks
Severity: Minor
Found in src/js/select2/data/tokenizer.js - About 1 hr to fix

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

    jQuery.fn.highlight = function(words, options) {
        var settings = {
            className: 'highlight',
            element: 'span',
            caseSensitive: false,
    Severity: Minor
    Found in docs/themes/learn2/js/learn.js - About 1 hr to fix

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

        SelectAdapter.prototype.option = function (data) {
          var option;
      
          if (data.children) {
            option = document.createElement('optgroup');
      Severity: Minor
      Found in src/js/select2/data/select.js - About 1 hr to fix

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

          SelectAdapter.prototype.select = function (data) {
            var self = this;
        
            data.selected = true;
        
        
        Severity: Minor
        Found in src/js/select2/data/select.js - About 1 hr to fix

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

            Defaults.prototype._processTranslations = function (languages, debug) {
              var translations = new Translation();
          
              for (var l = 0; l < languages.length; l++) {
                var languageData = new Translation();
          Severity: Minor
          Found in src/js/select2/defaults.js - About 1 hr to fix

            Function select2 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.select2 = function (options) {
                  options = options || {};
            
                  if (typeof options === 'object') {
                    this.each(function () {
            Severity: Minor
            Found in src/js/jquery.select2.js - About 1 hr to fix

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

                StopPropagation.prototype.bind = function (decorated, container, $container) {
                  decorated.call(this, container, $container);
              
                  var stoppedEvents = [
                  'blur',
              Severity: Minor
              Found in src/js/select2/dropdown/stopPropagation.js - About 1 hr to fix

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

                  EventRelay.prototype.bind = function (decorated, container, $container) {
                    var self = this;
                    var relayEvents = [
                      'open', 'opening',
                      'close', 'closing',
                Severity: Minor
                Found in src/js/select2/selection/eventRelay.js - About 1 hr to fix

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

                    StopPropagation.prototype.bind = function (decorated, container, $container) {
                      decorated.call(this, container, $container);
                  
                      var stoppedEvents = [
                        'blur',
                  Severity: Minor
                  Found in src/js/select2/selection/stopPropagation.js - About 1 hr to fix

                    Function highlight has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        highlight: function(node, re, nodeName, className) {
                            if (node.nodeType === 3) {
                                var match = node.data.match(re);
                                if (match) {
                                    var highlight = document.createElement(nodeName || 'span');
                    Severity: Minor
                    Found in docs/themes/learn2/js/learn.js - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function onPluginsInitialized has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function onPluginsInitialized()
                        {
                            if ($this->isAdmin()) {
                                $this->active = false;
                                return;
                    Severity: Minor
                    Found in docs/plugins/problems/problems.php - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function build has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function build()
                        {
                            $hierarchy = array();
                            $grav = Grav::instance();
                            $current = $grav['page'];
                    Severity: Minor
                    Found in docs/plugins/breadcrumbs/classes/breadcrumbs.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Avoid too many return statements within this function.
                    Open

                            return null;
                    Severity: Major
                    Found in src/js/select2/core.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return method;
                      Severity: Major
                      Found in src/js/select2/core.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return matches[1];
                        Severity: Major
                        Found in src/js/select2/core.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return computedStyle.width;
                          Severity: Major
                          Found in src/js/select2/core.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return null;
                            Severity: Major
                            Found in src/js/select2/core.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return null;
                              Severity: Major
                              Found in src/js/select2/defaults.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language