ivaynberg/select2

View on GitHub

Showing 136 of 136 total issues

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

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

    define(function () {
      // Chinese (Traditional)
      return {
        inputTooLong: function (args) {
          var overChars = args.input.length - args.maximum;
    Severity: Major
    Found in src/js/select2/i18n/zh-TW.js and 1 other location - About 1 day to fix
    src/js/select2/i18n/vi.js on lines 1..37

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

    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

    define(function () {
      // Vietnamese
      return {
        inputTooLong: function (args) {
          var overChars = args.input.length - args.maximum;
    Severity: Major
    Found in src/js/select2/i18n/vi.js and 1 other location - About 1 day to fix
    src/js/select2/i18n/zh-TW.js on lines 1..36

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

    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 6 locations. Consider refactoring.
    Open

    define(function () {
      // Hungarian
      return {
        errorLoading: function () {
          return 'Az eredmények betöltése nem sikerült.';
    Severity: Major
    Found in src/js/select2/i18n/hu.js and 5 other locations - About 1 day to fix
    src/js/select2/i18n/ar.js on lines 1..33
    src/js/select2/i18n/fi.js on lines 1..33
    src/js/select2/i18n/id.js on lines 1..33
    src/js/select2/i18n/ms.js on lines 1..33
    src/js/select2/i18n/nb.js on lines 1..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 199.

    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 6 locations. Consider refactoring.
    Open

    define(function () {
      // Finnish
      return {
        errorLoading: function () {
          return 'Tuloksia ei saatu ladattua.';
    Severity: Major
    Found in src/js/select2/i18n/fi.js and 5 other locations - About 1 day to fix
    src/js/select2/i18n/ar.js on lines 1..33
    src/js/select2/i18n/hu.js on lines 1..33
    src/js/select2/i18n/id.js on lines 1..33
    src/js/select2/i18n/ms.js on lines 1..33
    src/js/select2/i18n/nb.js on lines 1..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 199.

    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 6 locations. Consider refactoring.
    Open

    define(function () {
      // Norwegian (Bokmål)
      return {
        errorLoading: function () {
          return 'Kunne ikke hente resultater.';
    Severity: Major
    Found in src/js/select2/i18n/nb.js and 5 other locations - About 1 day to fix
    src/js/select2/i18n/ar.js on lines 1..33
    src/js/select2/i18n/fi.js on lines 1..33
    src/js/select2/i18n/hu.js on lines 1..33
    src/js/select2/i18n/id.js on lines 1..33
    src/js/select2/i18n/ms.js on lines 1..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 199.

    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 6 locations. Consider refactoring.
    Open

    define(function () {
      // Indonesian
      return {
        errorLoading: function () {
          return 'Data tidak boleh diambil.';
    Severity: Major
    Found in src/js/select2/i18n/id.js and 5 other locations - About 1 day to fix
    src/js/select2/i18n/ar.js on lines 1..33
    src/js/select2/i18n/fi.js on lines 1..33
    src/js/select2/i18n/hu.js on lines 1..33
    src/js/select2/i18n/ms.js on lines 1..33
    src/js/select2/i18n/nb.js on lines 1..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 199.

    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 6 locations. Consider refactoring.
    Open

    define(function () {
      // Malay
      return {
        errorLoading: function () {
          return 'Keputusan tidak berjaya dimuatkan.';
    Severity: Major
    Found in src/js/select2/i18n/ms.js and 5 other locations - About 1 day to fix
    src/js/select2/i18n/ar.js on lines 1..33
    src/js/select2/i18n/fi.js on lines 1..33
    src/js/select2/i18n/hu.js on lines 1..33
    src/js/select2/i18n/id.js on lines 1..33
    src/js/select2/i18n/nb.js on lines 1..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 199.

    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 6 locations. Consider refactoring.
    Open

    define(function () {
      // Arabic
      return {
        errorLoading: function () {
          return 'لا يمكن تحميل النتائج';
    Severity: Major
    Found in src/js/select2/i18n/ar.js and 5 other locations - About 1 day to fix
    src/js/select2/i18n/fi.js on lines 1..33
    src/js/select2/i18n/hu.js on lines 1..33
    src/js/select2/i18n/id.js on lines 1..33
    src/js/select2/i18n/ms.js on lines 1..33
    src/js/select2/i18n/nb.js on lines 1..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 199.

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

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

        define([
          '../utils'
        ], function (Utils) {
          function SelectionCSS () { }
        
        
        Severity: Major
        Found in src/js/select2/selection/selectionCss.js and 1 other location - About 6 hrs to fix
        src/js/select2/dropdown/dropdownCss.js on lines 1..23

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

        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

        define([
          '../utils'
        ], function (Utils) {
          function DropdownCSS () { }
        
        
        Severity: Major
        Found in src/js/select2/dropdown/dropdownCss.js and 1 other location - About 6 hrs to fix
        src/js/select2/selection/selectionCss.js on lines 1..23

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

        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

        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

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

              define([
              
              ], function () {
                function StopPropagation () { }
              
              
              Severity: Major
              Found in src/js/select2/selection/stopPropagation.js and 1 other location - About 4 hrs to fix
              src/js/select2/dropdown/stopPropagation.js on lines 1..38

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

              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

              define([
              
              ], function () {
                function StopPropagation () { }
              
              
              Severity: Major
              Found in src/js/select2/dropdown/stopPropagation.js and 1 other location - About 4 hrs to fix
              src/js/select2/selection/stopPropagation.js on lines 1..38

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

              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