ivaynberg/select2

View on GitHub

Showing 136 of 136 total issues

File problems.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Grav\Plugin;

use Grav\Common\Cache;
use Grav\Common\Plugin;
Severity: Minor
Found in docs/plugins/problems/problems.php - About 2 hrs to fix

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

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

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

        AjaxAdapter.prototype.query = function (params, callback) {
          var matches = [];
          var self = this;
      
          if (this._request != null) {
      Severity: Minor
      Found in src/js/select2/data/ajax.js - About 1 hr to fix

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

            container.on('unselect', function () {
              if (!container.isOpen()) {
                return;
              }
        
        
        Severity: Major
        Found in src/js/select2/results.js and 1 other location - About 1 hr to fix
        src/js/select2/results.js on lines 283..293

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

        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

            container.on('select', function () {
              if (!container.isOpen()) {
                return;
              }
        
        
        Severity: Major
        Found in src/js/select2/results.js and 1 other location - About 1 hr to fix
        src/js/select2/results.js on lines 295..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 73.

        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

          MultipleSelection.prototype.display = function (data, container) {
            var template = this.options.get('templateSelection');
            var escapeMarkup = this.options.get('escapeMarkup');
        
            return escapeMarkup(template(data, container));
        Severity: Major
        Found in src/js/select2/selection/multiple.js and 1 other location - About 1 hr to fix
        src/js/select2/selection/single.js on lines 73..78

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

        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

            jQuery('#overlay').on('click', function() {
                jQuery(document.body).toggleClass('sidebar-hidden');
                sidebarStatus = (jQuery(document.body).hasClass('sidebar-hidden') ? 'closed' : 'open');
        
                return false;
        Severity: Major
        Found in docs/themes/learn2/js/learn.js and 1 other location - About 1 hr to fix
        docs/themes/learn2/js/learn.js on lines 99..104

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

        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

            for (var d = 0; d < data.results.length; d++) {
              var item = data.results[d];
        
              var $option = this.option(item);
        
        
        Severity: Major
        Found in src/js/select2/results.js and 1 other location - About 1 hr to fix
        src/js/select2/results.js on lines 228..234

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

        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

          SingleSelection.prototype.display = function (data, container) {
            var template = this.options.get('templateSelection');
            var escapeMarkup = this.options.get('escapeMarkup');
        
            return escapeMarkup(template(data, container));
        Severity: Major
        Found in src/js/select2/selection/single.js and 1 other location - About 1 hr to fix
        src/js/select2/selection/multiple.js on lines 79..84

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

        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

              for (var c = 0; c < data.children.length; c++) {
                var child = data.children[c];
        
                var $child = this.option(child);
        
        
        Severity: Major
        Found in src/js/select2/results.js and 1 other location - About 1 hr to fix
        src/js/select2/results.js on lines 78..84

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

        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

            jQuery('[data-sidebar-toggle]').on('click', function() {
                jQuery(document.body).toggleClass('sidebar-hidden');
                sidebarStatus = (jQuery(document.body).hasClass('sidebar-hidden') ? 'closed' : 'open');
        
                return false;
        Severity: Major
        Found in docs/themes/learn2/js/learn.js and 1 other location - About 1 hr to fix
        docs/themes/learn2/js/learn.js on lines 90..95

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

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

          var Select2 = function ($element, options) {
            if (Utils.GetData($element[0], 'select2') != null) {
              Utils.GetData($element[0], 'select2').destroy();
            }
        
        
        Severity: Minor
        Found in src/js/select2/core.js - About 1 hr to fix

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

            Tags.prototype.query = function (decorated, params, callback) {
              var self = this;
          
              this._removeOldTags();
          
          
          Severity: Minor
          Found in src/js/select2/data/tags.js - About 1 hr to fix

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

              BaseSelection.prototype.bind = function (container, $container) {
                var self = this;
            
                var resultsId = container.id + '-results';
            
            
            Severity: Minor
            Found in src/js/select2/selection/base.js - About 1 hr to fix

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

                    maximumSelected: function (args) {
                      var message = 'तँपाई ' + args.maximum +
                        ' वस्तु मात्र छान्न पाउँनुहुन्छ।';
              
                      if (args.maximum != 1) {
              Severity: Major
              Found in src/js/select2/i18n/ne.js and 1 other location - About 1 hr to fix
              src/js/select2/i18n/pa.js on lines 36..44

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

              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

                  maximumSelected: function (args) {
                    var message = 'ਤੁਸੀਂ ਸਿਰਫ਼ ' + args.maximum + ' ਨਤੀਜਾ ਚੁਣ ਸਕਦੇ ਹੋ ।';
              
                    if(args.maximum != 1) {
                      message = 'ਤੁਸੀਂ ਸਿਰਫ਼ ' + args.maximum + ' ਨਤੀਜੇ ਚੁਣ ਸਕਦੇ ਹੋ ।';
              Severity: Major
              Found in src/js/select2/i18n/pa.js and 1 other location - About 1 hr to fix
              src/js/select2/i18n/ne.js on lines 29..39

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

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

                Utils.Decorate = function (SuperClass, DecoratorClass) {
                  var decoratedMethods = getMethods(DecoratorClass);
                  var superMethods = getMethods(SuperClass);
              
                  function DecoratedClass () {
              Severity: Minor
              Found in src/js/select2/utils.js - About 1 hr to fix

                Method notFound has 37 lines of code (exceeds 25 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 1 hr to fix

                  Method checkForPermissions has 36 lines of code (exceeds 25 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 1 hr to fix

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

                      MultipleSelection.prototype.bind = function (container, $container) {
                        var self = this;
                    
                        MultipleSelection.__super__.bind.apply(this, arguments);
                    
                    
                    Severity: Minor
                    Found in src/js/select2/selection/multiple.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language