ivaynberg/select2

View on GitHub

Showing 58 of 136 total issues

File diacritics.js has 848 lines of code (exceeds 250 allowed). Consider refactoring.
Open

define([

], function () {
  var diacritics = {
    '\u24B6': 'A',
Severity: Major
Found in src/js/select2/diacritics.js - About 2 days to fix

    Function onPagesInitialized has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

        public function onPagesInitialized()
        {
            $page = $this->grav['page'];
    
            $route = null;
    Severity: Minor
    Found in docs/plugins/simplesearch/simplesearch.php - About 1 day 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 exports has 216 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (grunt) {
      // Full list of files that must be included by RequireJS
      includes = [
        'jquery.select2',
        'almond',
    Severity: Major
    Found in Gruntfile.js - About 1 day to fix

      Function problemChecker has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function problemChecker()
          {
              $min_php_version = defined('GRAV_PHP_MIN') ? GRAV_PHP_MIN : '5.4.0';
              $problems_found = false;
      
      
      Severity: Minor
      Found in docs/plugins/problems/problems.php - About 7 hrs 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 bind has 170 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        Results.prototype.bind = function (container, $container) {
          var self = this;
      
          var id = container.id + '-results';
      
      
      Severity: Major
      Found in src/js/select2/results.js - About 6 hrs to fix

        File core.js has 435 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        define([
          'jquery',
          './options',
          './utils',
          './keys'
        Severity: Minor
        Found in src/js/select2/core.js - About 6 hrs to fix

          Method problemChecker has 152 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function problemChecker()
              {
                  $min_php_version = defined('GRAV_PHP_MIN') ? GRAV_PHP_MIN : '5.4.0';
                  $problems_found = false;
          
          
          Severity: Major
          Found in docs/plugins/problems/problems.php - About 6 hrs to fix

            Function checkForPermissions has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                public function checkForPermissions($collection)
                {
                    $user = $this->grav['user'];
                    $returnCollection = new Collection();
                    foreach ($collection as $page) {
            Severity: Minor
            Found in docs/plugins/simplesearch/simplesearch.php - About 5 hrs 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 apply has 138 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Defaults.prototype.apply = function (options) {
                options = $.extend(true, {}, this.defaults, options);
            
                if (options.dataAdapter == null) {
                  if (options.ajax != null) {
            Severity: Major
            Found in src/js/select2/defaults.js - About 5 hrs to fix

              File results.js has 390 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              define([
                'jquery',
                './utils'
              ], function ($, Utils) {
                function Results ($element, options, dataAdapter) {
              Severity: Minor
              Found in src/js/select2/results.js - About 5 hrs to fix

                Function notFound has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function notFound($query, $page, $taxonomies)
                    {
                        $searchable_types = ['title', 'content', 'taxonomy'];
                        $results = true;
                        $search_content = $this->config->get('plugins.simplesearch.search_content');
                Severity: Minor
                Found in docs/plugins/simplesearch/simplesearch.php - About 4 hrs 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

                Method onPagesInitialized has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function onPagesInitialized()
                    {
                        $page = $this->grav['page'];
                
                        $route = null;
                Severity: Major
                Found in docs/plugins/simplesearch/simplesearch.php - About 4 hrs to fix

                  File defaults.js has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  define([
                    'jquery',
                  
                    './results',
                  
                  
                  Severity: Minor
                  Found in src/js/select2/defaults.js - About 3 hrs to fix

                    Function renderProblems has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function renderProblems()
                        {
                            $theme = 'antimatter';
                    
                            /** @var Uri $uri */
                    Severity: Minor
                    Found in docs/plugins/problems/problems.php - About 3 hrs 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 bind has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      Search.prototype.bind = function (decorated, container, $container) {
                        var self = this;
                    
                        var resultsId = container.id + '-results';
                        var selectionId = container.id + '-container';
                    Severity: Major
                    Found in src/js/select2/selection/search.js - About 3 hrs to fix

                      Function fromElement has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        Options.prototype.fromElement = function ($e) {
                          var excludedData = ['select2'];
                      
                          if (this.options.multiple == null) {
                            this.options.multiple = $e.prop('multiple');
                      Severity: Major
                      Found in src/js/select2/options.js - About 2 hrs to fix

                        Function _positionDropdown has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          AttachBody.prototype._positionDropdown = function () {
                            var $window = $(window);
                        
                            var isCurrentlyAbove = this.$dropdown[0].classList
                              .contains('select2-dropdown--above');
                        Severity: Major
                        Found in src/js/select2/dropdown/attachBody.js - About 2 hrs to fix

                          Function _registerEvents has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            Select2.prototype._registerEvents = function () {
                              var self = this;
                          
                              this.on('open', function () {
                                self.$container[0].classList.add('select2-container--open');
                          Severity: Major
                          Found in src/js/select2/core.js - About 2 hrs to fix

                            File learn.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // Scrollbar Width function
                            function getScrollBarWidth() {
                                var inner = document.createElement('p');
                                inner.style.width = "100%";
                                inner.style.height = "200px";
                            Severity: Minor
                            Found in docs/themes/learn2/js/learn.js - About 2 hrs to fix

                              Function reset has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                Defaults.prototype.reset = function () {
                                  function stripDiacritics (text) {
                                    // Used 'uni range + named function' from http://jsperf.com/diacritics/18
                                    function match(a) {
                                      return DIACRITICS[a] || a;
                              Severity: Major
                              Found in src/js/select2/defaults.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language