ivaynberg/select2

View on GitHub

Showing 136 of 136 total issues

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

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

                    inputTooShort: function (args) {
                      var remainingChars = args.minimum - args.input.length;
                
                      var message = 'Idatzi ';
                
                
                Severity: Major
                Found in src/js/select2/i18n/eu.js and 1 other location - About 2 hrs to fix
                src/js/select2/i18n/he.js on lines 20..34

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

                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

                    inputTooShort: function (args) {
                      var remainingChars = args.minimum - args.input.length;
                
                      var message = 'נא להכניס ';
                
                
                Severity: Major
                Found in src/js/select2/i18n/he.js and 1 other location - About 2 hrs to fix
                src/js/select2/i18n/eu.js on lines 19..33

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

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

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

                    Results.prototype.option = function (data) {
                      var option = document.createElement('li');
                      option.classList.add('select2-results__option');
                      option.classList.add('select2-results__option--selectable');
                  
                  
                  Severity: Major
                  Found in src/js/select2/results.js - About 2 hrs to fix

                    File simplesearch.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    namespace Grav\Plugin;
                    
                    use Grav\Common\Page\Collection;
                    use Grav\Common\Plugin;
                    Severity: Minor
                    Found in docs/plugins/simplesearch/simplesearch.php - About 2 hrs to fix

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

                            inputTooLong: function (args) {
                              var overChars = args.input.length - args.maximum;
                      
                              var message = 'कृपया ' + overChars + ' अक्षर मेटाउनुहोस्।';
                      
                      
                      Severity: Major
                      Found in src/js/select2/i18n/ne.js and 1 other location - About 2 hrs to fix
                      src/js/select2/i18n/bn.js on lines 7..17

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

                      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

                            inputTooLong: function (args) {
                              var overChars = args.input.length - args.maximum;
                        
                              var message = 'অনুগ্রহ করে ' + overChars + ' টি অক্ষর মুছে দিন।';
                        
                      Severity: Major
                      Found in src/js/select2/i18n/bn.js and 1 other location - About 2 hrs to fix
                      src/js/select2/i18n/ne.js on lines 7..17

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

                      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

                          inputTooShort: function (args) {
                            var remainingChars = args.minimum - args.input.length;
                      
                            var message = 'Vinsamlegast skrifið ' + remainingChars + ' staf';
                      
                      
                      Severity: Major
                      Found in src/js/select2/i18n/is.js and 1 other location - About 2 hrs to fix
                      src/js/select2/i18n/et.js on lines 17..29

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

                      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

                          inputTooShort: function (args) {
                            var remainingChars = args.minimum - args.input.length;
                      
                            var message = 'Sisesta ' + remainingChars + ' täht';
                      
                      
                      Severity: Major
                      Found in src/js/select2/i18n/et.js and 1 other location - About 2 hrs to fix
                      src/js/select2/i18n/is.js on lines 15..27

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

                      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

                          container.on('results:focus', function (params) {
                            if (params.data._resultId) {
                              self.$search.attr('aria-activedescendant', params.data._resultId);
                            } else {
                              self.$search.removeAttr('aria-activedescendant');
                      Severity: Major
                      Found in src/js/select2/dropdown/search.js and 1 other location - About 2 hrs to fix
                      src/js/select2/selection/search.js on lines 69..75

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

                      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

                          container.on('results:focus', function (params) {
                            if (params.data._resultId) {
                              self.$search.attr('aria-activedescendant', params.data._resultId);
                            } else {
                              self.$search.removeAttr('aria-activedescendant');
                      Severity: Major
                      Found in src/js/select2/selection/search.js and 1 other location - About 2 hrs to fix
                      src/js/select2/dropdown/search.js on lines 90..96

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language