WordPress/WordPress

View on GitHub
wp-includes/js/dist/shortcode.js

Summary

Maintainability
F
6 days
Test Coverage

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

function memize(fn, options) {
    var size = 0;

    /** @type {?MemizeCacheNode|undefined} */
    var head;
Severity: Major
Found in wp-includes/js/dist/shortcode.js - About 2 hrs to fix

    Function memoized has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function memoized(/* ...args */) {
            var node = head,
                len = arguments.length,
                args,
                i;
    Severity: Minor
    Found in wp-includes/js/dist/shortcode.js - About 1 hr to fix

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

      const shortcode = Object.assign(function (options) {
        const {
          tag,
          attrs: attributes,
          type,
      Severity: Minor
      Found in wp-includes/js/dist/shortcode.js - About 1 hr to fix

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

        function memize(fn, options) {
            var size = 0;
        
            /** @type {?MemizeCacheNode|undefined} */
            var head;
        Severity: Major
        Found in wp-includes/js/dist/shortcode.js and 2 other locations - About 3 days to fix
        wp-includes/js/dist/core-data.js on lines 7193..7311
        wp-includes/js/dist/plugins.js on lines 103..221

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

        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

          while (match = pattern.exec(text)) {
            if (match[1]) {
              named[match[1].toLowerCase()] = match[2];
            } else if (match[3]) {
              named[match[3].toLowerCase()] = match[4];
        Severity: Major
        Found in wp-includes/js/dist/shortcode.js and 1 other location - About 1 day to fix
        wp-includes/js/shortcode.js on lines 165..179

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

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

        /******/     (() => {
        /******/         // define getter functions for harmony exports
        /******/         __webpack_require__.d = (exports, definition) => {
        /******/             for(var key in definition) {
        /******/                 if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
        Severity: Major
        Found in wp-includes/js/dist/shortcode.js and 34 other locations - About 4 hrs to fix
        wp-includes/blocks/file/view.js on lines 7..16
        wp-includes/blocks/image/view.js on lines 7..16
        wp-includes/blocks/navigation/view.js on lines 7..16
        wp-includes/blocks/search/view.js on lines 7..16
        wp-includes/js/dist/annotations.js on lines 8..17
        wp-includes/js/dist/api-fetch.js on lines 8..17
        wp-includes/js/dist/autop.js on lines 8..17
        wp-includes/js/dist/blob.js on lines 8..17
        wp-includes/js/dist/block-serialization-default-parser.js on lines 8..17
        wp-includes/js/dist/core-commands.js on lines 8..17
        wp-includes/js/dist/deprecated.js on lines 8..17
        wp-includes/js/dist/dom-ready.js on lines 8..17
        wp-includes/js/dist/element.js on lines 54..63
        wp-includes/js/dist/escape-html.js on lines 8..17
        wp-includes/js/dist/hooks.js on lines 8..17
        wp-includes/js/dist/html-entities.js on lines 8..17
        wp-includes/js/dist/interactivity-router.js on lines 7..16
        wp-includes/js/dist/interactivity.js on lines 6..15
        wp-includes/js/dist/is-shallow-equal.js on lines 8..17
        wp-includes/js/dist/keyboard-shortcuts.js on lines 8..17
        wp-includes/js/dist/keycodes.js on lines 8..17
        wp-includes/js/dist/notices.js on lines 8..17
        wp-includes/js/dist/patterns.js on lines 8..17
        wp-includes/js/dist/primitives.js on lines 8..17
        wp-includes/js/dist/priority-queue.js on lines 251..260
        wp-includes/js/dist/private-apis.js on lines 8..17
        wp-includes/js/dist/redux-routine.js on lines 682..691
        wp-includes/js/dist/reusable-blocks.js on lines 8..17
        wp-includes/js/dist/router.js on lines 8..17
        wp-includes/js/dist/style-engine.js on lines 8..17
        wp-includes/js/dist/token-list.js on lines 8..17
        wp-includes/js/dist/viewport.js on lines 8..17
        wp-includes/js/dist/warning.js on lines 8..17
        wp-includes/js/dist/wordcount.js on lines 8..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 130.

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

        /******/     (() => {
        /******/         __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
        /******/     })();
        Severity: Major
        Found in wp-includes/js/dist/shortcode.js and 13 other locations - About 1 hr to fix
        wp-includes/blocks/file/view.js on lines 19..21
        wp-includes/blocks/image/view.js on lines 19..21
        wp-includes/blocks/navigation/view.js on lines 19..21
        wp-includes/blocks/search/view.js on lines 19..21
        wp-includes/js/dist/api-fetch.js on lines 20..22
        wp-includes/js/dist/deprecated.js on lines 20..22
        wp-includes/js/dist/dom-ready.js on lines 20..22
        wp-includes/js/dist/interactivity-router.js on lines 19..21
        wp-includes/js/dist/interactivity.js on lines 18..20
        wp-includes/js/dist/redux-routine.js on lines 694..696
        wp-includes/js/dist/server-side-render.js on lines 136..138
        wp-includes/js/dist/token-list.js on lines 20..22
        wp-includes/js/dist/warning.js on lines 20..22

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

        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

            if ('single' === this.type) {
              return text + ']';
            } else if ('self-closing' === this.type) {
              return text + ' /]';
            }
        Severity: Minor
        Found in wp-includes/js/dist/shortcode.js and 1 other location - About 45 mins to fix
        wp-includes/js/shortcode.js on lines 298..302

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

        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

            this.attrs.numeric.forEach(value => {
              if (/\s/.test(value)) {
                text += ' "' + value + '"';
              } else {
                text += ' ' + value;
        Severity: Minor
        Found in wp-includes/js/dist/shortcode.js and 1 other location - About 40 mins to fix
        wp-includes/js/shortcode.js on lines 284..290

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

        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

          if (match[4]) {
            type = 'self-closing';
          } else if (match[6]) {
            type = 'closed';
          } else {
        Severity: Minor
        Found in wp-includes/js/dist/shortcode.js and 1 other location - About 40 mins to fix
        wp-includes/js/shortcode.js on lines 197..203

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

        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

          if (match[1]) {
            result.content = result.content.slice(1);
            result.index++;
          }
        Severity: Minor
        Found in wp-includes/js/dist/shortcode.js and 1 other location - About 40 mins to fix
        wp-includes/js/shortcode.js on lines 49..52

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

        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

        There are no issues that match your filters.

        Category
        Status