WordPress/WordPress

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

Summary

Maintainability
F
1 wk
Test Coverage

File patterns.js has 1083 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/******/ (() => { // webpackBootstrap
/******/     "use strict";
/******/     // The require scope
/******/     var __webpack_require__ = {};
/******/     
Severity: Major
Found in wp-includes/js/dist/patterns.js - About 2 days to fix

    Function useAddPatternCategory has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function useAddPatternCategory() {
      const {
        saveEntityRecord,
        invalidateResolution
      } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
    Severity: Major
    Found in wp-includes/js/dist/patterns.js - About 2 hrs to fix

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

      function ResetOverridesControl(props) {
        const name = props.attributes.metadata?.name;
        const registry = (0,external_wp_data_namespaceObject.useRegistry)();
        const isOverriden = (0,external_wp_data_namespaceObject.useSelect)(select => {
          if (!name) {
      Severity: Major
      Found in wp-includes/js/dist/patterns.js - About 2 hrs to fix

        Function onSave has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const onSave = async event => {
            event.preventDefault();
            if (isSaving) {
              return;
            }
        Severity: Minor
        Found in wp-includes/js/dist/patterns.js - About 1 hr to fix

          Function onRename has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const onRename = async event => {
              event.preventDefault();
              if (!name || name === pattern.title || isSaving) {
                return;
              }
          Severity: Minor
          Found in wp-includes/js/dist/patterns.js - About 1 hr to fix

            Function onClick has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function onClick() {
                const {
                  getBlockAttributes,
                  getBlockParentsByBlockName
                } = registry.select(external_wp_blockEditor_namespaceObject.store);
            Severity: Minor
            Found in wp-includes/js/dist/patterns.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                if (parsedContent.__file !== 'wp_block' || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== 'string' || typeof parsedContent.content !== 'string' || parsedContent.syncStatus && typeof parsedContent.syncStatus !== 'string') {
                  throw new Error('Invalid pattern JSON file');
                }
              Severity: Major
              Found in wp-includes/js/dist/patterns.js - About 1 hr to fix

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

                  const canConvert = (0,external_wp_data_namespaceObject.useSelect)(select => {
                    var _getBlocksByClientId;
                    const {
                      canUser
                    } = select(external_wp_coreData_namespaceObject.store);
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 1 day to fix
                wp-includes/js/dist/reusable-blocks.js on lines 304..331

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

                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

                  const {
                    canRemove,
                    isVisible,
                    managePatternsUrl
                  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 1 day to fix
                wp-includes/js/dist/reusable-blocks.js on lines 429..456

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

                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

                function PatternsMenuItems({
                  rootClientId
                }) {
                  return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({
                    selectedClientIds,
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 4 hrs to fix
                wp-includes/js/dist/reusable-blocks.js on lines 483..496

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

                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/patterns.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/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/shortcode.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 42 locations. Consider refactoring.
                Open

                /******/     (() => {
                /******/         // define __esModule on exports
                /******/         __webpack_require__.r = (exports) => {
                /******/             if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
                /******/                 Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 41 other locations - About 4 hrs to fix
                wp-includes/js/dist/a11y.js on lines 37..45
                wp-includes/js/dist/annotations.js on lines 25..33
                wp-includes/js/dist/autop.js on lines 25..33
                wp-includes/js/dist/blob.js on lines 25..33
                wp-includes/js/dist/block-directory.js on lines 37..45
                wp-includes/js/dist/block-serialization-default-parser.js on lines 25..33
                wp-includes/js/dist/compose.js on lines 2262..2270
                wp-includes/js/dist/core-commands.js on lines 25..33
                wp-includes/js/dist/core-data.js on lines 644..652
                wp-includes/js/dist/customize-widgets.js on lines 141..149
                wp-includes/js/dist/data-controls.js on lines 37..45
                wp-includes/js/dist/data.js on lines 516..524
                wp-includes/js/dist/dom.js on lines 37..45
                wp-includes/js/dist/edit-post.js on lines 37..45
                wp-includes/js/dist/edit-widgets.js on lines 37..45
                wp-includes/js/dist/element.js on lines 71..79
                wp-includes/js/dist/escape-html.js on lines 25..33
                wp-includes/js/dist/hooks.js on lines 25..33
                wp-includes/js/dist/html-entities.js on lines 25..33
                wp-includes/js/dist/i18n.js on lines 300..308
                wp-includes/js/dist/is-shallow-equal.js on lines 25..33
                wp-includes/js/dist/keyboard-shortcuts.js on lines 25..33
                wp-includes/js/dist/keycodes.js on lines 25..33
                wp-includes/js/dist/list-reusable-blocks.js on lines 37..45
                wp-includes/js/dist/media-utils.js on lines 37..45
                wp-includes/js/dist/notices.js on lines 25..33
                wp-includes/js/dist/nux.js on lines 37..45
                wp-includes/js/dist/plugins.js on lines 37..45
                wp-includes/js/dist/preferences-persistence.js on lines 37..45
                wp-includes/js/dist/preferences.js on lines 37..45
                wp-includes/js/dist/primitives.js on lines 25..33
                wp-includes/js/dist/priority-queue.js on lines 280..288
                wp-includes/js/dist/private-apis.js on lines 25..33
                wp-includes/js/dist/reusable-blocks.js on lines 25..33
                wp-includes/js/dist/router.js on lines 25..33
                wp-includes/js/dist/style-engine.js on lines 25..33
                wp-includes/js/dist/undo-manager.js on lines 69..77
                wp-includes/js/dist/url.js on lines 549..557
                wp-includes/js/dist/viewport.js on lines 25..33
                wp-includes/js/dist/widgets.js on lines 37..45
                wp-includes/js/dist/wordcount.js on lines 25..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 117.

                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

                  }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
                    justify: "right"
                  }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
                    __next40pxDefaultSize: true,
                    variant: "tertiary",
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 3 hrs to fix
                wp-includes/js/dist/patterns.js on lines 1290..1300

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

                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

                  }, (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern.')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
                    justify: "right"
                  }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
                    __next40pxDefaultSize: true,
                    variant: "tertiary",
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 3 hrs to fix
                wp-includes/js/dist/patterns.js on lines 805..815

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

                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 (parsedContent.__file !== 'wp_block' || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== 'string' || typeof parsedContent.content !== 'string' || parsedContent.syncStatus && typeof parsedContent.syncStatus !== 'string') {
                    throw new Error('Invalid pattern JSON file');
                  }
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 2 hrs to fix
                wp-includes/js/dist/list-reusable-blocks.js on lines 620..622

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

                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

                lock(privateApis, {
                  OverridesPanel: OverridesPanel,
                  CreatePatternModal: CreatePatternModal,
                  CreatePatternModalContents: CreatePatternModalContents,
                  DuplicatePatternModal: DuplicatePatternModal,
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 2 hrs to fix
                wp-includes/js/dist/hooks.js on lines 570..589

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

                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

                  }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
                    label: (0,external_wp_i18n_namespaceObject.__)('Name'),
                    value: title,
                    onChange: setTitle,
                    placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern'),
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 2 hrs to fix
                wp-includes/js/dist/edit-post.js on lines 1825..1833

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

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

                const symbol = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
                  xmlns: "http://www.w3.org/2000/svg",
                  viewBox: "0 0 24 24"
                }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
                  d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 54 other locations - About 1 hr to fix
                wp-includes/js/dist/block-directory.js on lines 1358..1363
                wp-includes/js/dist/block-directory.js on lines 1372..1377
                wp-includes/js/dist/block-directory.js on lines 1760..1765
                wp-includes/js/dist/commands.js on lines 3191..3196
                wp-includes/js/dist/core-commands.js on lines 59..64
                wp-includes/js/dist/core-commands.js on lines 105..110
                wp-includes/js/dist/core-commands.js on lines 135..140
                wp-includes/js/dist/core-commands.js on lines 149..154
                wp-includes/js/dist/core-commands.js on lines 163..168
                wp-includes/js/dist/core-commands.js on lines 177..182
                wp-includes/js/dist/core-commands.js on lines 191..196
                wp-includes/js/dist/customize-widgets.js on lines 301..306
                wp-includes/js/dist/customize-widgets.js on lines 315..320
                wp-includes/js/dist/customize-widgets.js on lines 329..334
                wp-includes/js/dist/customize-widgets.js on lines 343..348
                wp-includes/js/dist/customize-widgets.js on lines 562..567
                wp-includes/js/dist/customize-widgets.js on lines 576..581
                wp-includes/js/dist/edit-post.js on lines 1980..1985
                wp-includes/js/dist/edit-post.js on lines 2840..2845
                wp-includes/js/dist/edit-post.js on lines 2854..2859
                wp-includes/js/dist/edit-post.js on lines 2868..2873
                wp-includes/js/dist/edit-widgets.js on lines 298..303
                wp-includes/js/dist/edit-widgets.js on lines 312..317
                wp-includes/js/dist/edit-widgets.js on lines 346..351
                wp-includes/js/dist/edit-widgets.js on lines 3113..3118
                wp-includes/js/dist/edit-widgets.js on lines 3350..3355
                wp-includes/js/dist/edit-widgets.js on lines 3364..3369
                wp-includes/js/dist/edit-widgets.js on lines 3378..3383
                wp-includes/js/dist/edit-widgets.js on lines 3392..3397
                wp-includes/js/dist/edit-widgets.js on lines 3600..3605
                wp-includes/js/dist/edit-widgets.js on lines 3614..3619
                wp-includes/js/dist/edit-widgets.js on lines 4152..4157
                wp-includes/js/dist/format-library.js on lines 39..44
                wp-includes/js/dist/format-library.js on lines 106..111
                wp-includes/js/dist/format-library.js on lines 352..357
                wp-includes/js/dist/format-library.js on lines 423..428
                wp-includes/js/dist/format-library.js on lines 1107..1112
                wp-includes/js/dist/format-library.js on lines 1238..1243
                wp-includes/js/dist/format-library.js on lines 1252..1257
                wp-includes/js/dist/format-library.js on lines 1532..1537
                wp-includes/js/dist/format-library.js on lines 1588..1593
                wp-includes/js/dist/format-library.js on lines 1644..1649
                wp-includes/js/dist/format-library.js on lines 1700..1705
                wp-includes/js/dist/format-library.js on lines 1762..1767
                wp-includes/js/dist/nux.js on lines 336..341
                wp-includes/js/dist/plugins.js on lines 329..334
                wp-includes/js/dist/preferences.js on lines 92..97
                wp-includes/js/dist/preferences.js on lines 556..561
                wp-includes/js/dist/preferences.js on lines 570..575
                wp-includes/js/dist/reusable-blocks.js on lines 238..243
                wp-includes/js/dist/widgets.js on lines 92..97
                wp-includes/js/dist/widgets.js on lines 112..117
                wp-includes/js/dist/widgets.js on lines 1287..1292
                wp-includes/js/dist/widgets.js on lines 1489..1494

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

                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

                  return (0,external_React_namespaceObject.createElement)(CreatePatternModal, {
                    modalTitle: (0,external_wp_i18n_namespaceObject.__)('Duplicate pattern'),
                    confirmLabel: (0,external_wp_i18n_namespaceObject.__)('Duplicate'),
                    onClose: onClose,
                    onError: onClose,
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 1 hr to fix
                wp-includes/js/codemirror/esprima.js on lines 2001..2035

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

                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 (existingCategories.patternCategories.find(existingCategory => {
                      // Compare the id so that the we don't disallow the user changing the case of their current category
                      // (i.e. renaming 'test' to 'Test').
                      return existingCategory.id !== category.id && existingCategory.label.toLowerCase() === name.toLowerCase();
                    })) {
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 1 hr to fix
                wp-includes/js/dist/patterns.js on lines 1105..1111

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

                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 (!name || name === category.name) {
                      const message = (0,external_wp_i18n_namespaceObject.__)('Please enter a new name for this category.');
                      (0,external_wp_a11y_namespaceObject.speak)(message, 'assertive');
                      setValidationMessage(message);
                      textControlRef.current?.focus();
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 1 hr to fix
                wp-includes/js/dist/patterns.js on lines 1114..1124

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

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

                /******/     (() => {
                /******/         __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
                /******/     })();
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 42 other locations - About 1 hr to fix
                wp-includes/js/dist/a11y.js on lines 32..34
                wp-includes/js/dist/annotations.js on lines 20..22
                wp-includes/js/dist/autop.js on lines 20..22
                wp-includes/js/dist/blob.js on lines 20..22
                wp-includes/js/dist/block-directory.js on lines 32..34
                wp-includes/js/dist/block-serialization-default-parser.js on lines 20..22
                wp-includes/js/dist/commands.js on lines 198..200
                wp-includes/js/dist/compose.js on lines 2257..2259
                wp-includes/js/dist/core-commands.js on lines 20..22
                wp-includes/js/dist/core-data.js on lines 639..641
                wp-includes/js/dist/customize-widgets.js on lines 136..138
                wp-includes/js/dist/data-controls.js on lines 32..34
                wp-includes/js/dist/data.js on lines 511..513
                wp-includes/js/dist/dom.js on lines 32..34
                wp-includes/js/dist/edit-post.js on lines 32..34
                wp-includes/js/dist/edit-widgets.js on lines 32..34
                wp-includes/js/dist/element.js on lines 66..68
                wp-includes/js/dist/escape-html.js on lines 20..22
                wp-includes/js/dist/hooks.js on lines 20..22
                wp-includes/js/dist/html-entities.js on lines 20..22
                wp-includes/js/dist/i18n.js on lines 295..297
                wp-includes/js/dist/is-shallow-equal.js on lines 20..22
                wp-includes/js/dist/keyboard-shortcuts.js on lines 20..22
                wp-includes/js/dist/keycodes.js on lines 20..22
                wp-includes/js/dist/list-reusable-blocks.js on lines 32..34
                wp-includes/js/dist/media-utils.js on lines 32..34
                wp-includes/js/dist/notices.js on lines 20..22
                wp-includes/js/dist/nux.js on lines 32..34
                wp-includes/js/dist/plugins.js on lines 32..34
                wp-includes/js/dist/preferences-persistence.js on lines 32..34
                wp-includes/js/dist/preferences.js on lines 32..34
                wp-includes/js/dist/primitives.js on lines 20..22
                wp-includes/js/dist/priority-queue.js on lines 275..277
                wp-includes/js/dist/private-apis.js on lines 20..22
                wp-includes/js/dist/reusable-blocks.js on lines 20..22
                wp-includes/js/dist/router.js on lines 20..22
                wp-includes/js/dist/style-engine.js on lines 20..22
                wp-includes/js/dist/undo-manager.js on lines 64..66
                wp-includes/js/dist/url.js on lines 544..546
                wp-includes/js/dist/viewport.js on lines 20..22
                wp-includes/js/dist/widgets.js on lines 32..34
                wp-includes/js/dist/wordcount.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 58.

                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

                function isEditingPattern(state = {}, action) {
                  if (action?.type === 'SET_EDITING_PATTERN') {
                    return {
                      ...state,
                      [action.clientId]: action.isEditing
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 1 hr to fix
                wp-includes/js/dist/reusable-blocks.js on lines 171..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 58.

                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

                  const categories = (0,external_wp_data_namespaceObject.useSelect)(select => {
                    const {
                      getUserPatternCategories,
                      getBlockPatternCategories
                    } = select(external_wp_coreData_namespaceObject.store);
                Severity: Minor
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 55 mins to fix
                wp-includes/js/dist/patterns.js on lines 449..458

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

                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

                  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
                    const {
                      getUserPatternCategories,
                      getBlockPatternCategories
                    } = select(external_wp_coreData_namespaceObject.store);
                Severity: Minor
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 55 mins to fix
                wp-includes/js/dist/patterns.js on lines 668..677

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

                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

                    return categories.core?.filter(category => pattern.categories.includes(category.name)).map(category => category.label);
                Severity: Minor
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 50 mins to fix
                wp-includes/js/dist/patterns.js on lines 659..659

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

                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

                  return categories.user?.filter(category => pattern.wp_pattern_category.includes(category.id)).map(category => category.label);
                Severity: Minor
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 50 mins to fix
                wp-includes/js/dist/patterns.js on lines 657..657

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

                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

                __webpack_require__.d(actions_namespaceObject, {
                  convertSyncedPatternToStatic: () => (convertSyncedPatternToStatic),
                  createPattern: () => (createPattern),
                  createPatternFromFile: () => (createPatternFromFile),
                  setEditingPattern: () => (setEditingPattern)
                Severity: Major
                Found in wp-includes/js/dist/patterns.js and 5 other locations - About 35 mins to fix
                wp-includes/js/dist/annotations.js on lines 48..53
                wp-includes/js/dist/commands.js on lines 250..255
                wp-includes/js/dist/nux.js on lines 61..66
                wp-includes/js/dist/preferences.js on lines 62..67
                wp-includes/js/dist/reusable-blocks.js on lines 49..54

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

                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

                  return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, canRemove && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
                    onClick: () => convertSyncedPatternToStatic(clientId)
                  }, (0,external_wp_i18n_namespaceObject.__)('Detach')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
                Severity: Minor
                Found in wp-includes/js/dist/patterns.js and 1 other location - About 35 mins to fix
                wp-includes/js/dist/reusable-blocks.js on lines 465..467

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

                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