WordPress/WordPress

View on GitHub

Showing 10,370 of 14,330 total issues

Function editor_settings has a Cognitive Complexity of 184 (exceeds 5 allowed). Consider refactoring.
Open

    public static function editor_settings( $editor_id, $set ) {
        if ( empty( self::$first_init ) ) {
            if ( is_admin() ) {
                add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
                add_action( 'admin_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 );
Severity: Minor
Found in wp-includes/class-wp-editor.php - About 3 days 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

File block-directory.js has 1417 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/block-directory.js - About 3 days to fix

    File format-library.js has 1415 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/format-library.js - About 3 days to fix

      File option.php has 1412 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Option API
       *
       * @package WordPress
      Severity: Major
      Found in wp-includes/option.php - About 3 days to fix

        Function single_row has a Cognitive Complexity of 182 (exceeds 5 allowed). Consider refactoring.
        Open

            public function single_row( $item ) {
                global $status, $page, $s, $totals;
                static $plugin_id_attrs = array();
        
                list( $plugin_file, $plugin_data ) = $item;
        Severity: Minor
        Found in wp-admin/includes/class-wp-plugins-list-table.php - About 3 days 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

        File media-template.php has 1400 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * WordPress media templates.
         *
         * @package WordPress
        Severity: Major
        Found in wp-includes/media-template.php - About 3 days to fix

          Function mediaWidgets has 711 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          wp.mediaWidgets = ( function( $ ) {
              'use strict';
          
              var component = {};
          
          
          Severity: Major
          Found in wp-admin/js/widgets/media-widgets.js - About 3 days to fix

            Function jsonlint has a Cognitive Complexity of 174 (exceeds 5 allowed). Consider refactoring.
            Open

            var jsonlint = (function(){
            var parser = {trace: function trace() { },
            yy: {},
            symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1},
            terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},
            Severity: Minor
            Found in wp-includes/js/codemirror/jsonlint.js - About 3 days to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method create_initial_post_types has 703 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function create_initial_post_types() {
                WP_Post_Type::reset_default_labels();
            
                register_post_type(
                    'post',
            Severity: Major
            Found in wp-includes/post.php - About 3 days to fix

              Function debug_data has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function debug_data() {
                      global $wpdb, $_wp_theme_features;
              
                      // Save few function calls.
                      $upload_dir             = wp_upload_dir();
              Severity: Minor
              Found in wp-admin/includes/class-wp-debug-data.php - About 3 days 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 link has 690 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var link = (function (domGlobals) {
                  'use strict';
              
                  var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
              
              
              Severity: Major
              Found in wp-includes/js/tinymce/plugins/link/plugin.js - About 3 days to fix

                File dashboard.php has 1311 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * WordPress Dashboard Widget Administration Screen API
                 *
                 * @package WordPress
                Severity: Major
                Found in wp-admin/includes/dashboard.php - About 3 days to fix

                  Function ParseRIFF has a Cognitive Complexity of 168 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function ParseRIFF($startoffset, $maxoffset) {
                          $info = &$this->getid3->info;
                  
                          $RIFFchunk = array();
                          $FoundAllChunksWeNeed = false;
                  Severity: Minor
                  Found in wp-includes/ID3/module.audio-video.riff.php - About 3 days 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

                  File theme.js has 1299 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * @output wp-admin/js/theme.js
                   */
                  
                  /* global _wpThemeSettings, confirm, tb_position */
                  Severity: Major
                  Found in wp-admin/js/theme.js - About 3 days to fix

                    File pluggable.php has 1291 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * These functions can be replaced via plugins. If plugins do not redefine these
                     * functions, then these will be used instead.
                     *
                    Severity: Major
                    Found in wp-includes/pluggable.php - About 3 days to fix

                      File class-wp-debug-data.php has 1283 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * Class for providing debug data based on a users WordPress environment.
                       *
                       * @package WordPress
                      Severity: Major
                      Found in wp-admin/includes/class-wp-debug-data.php - About 3 days to fix

                        File backbone.js has 1278 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        //     Backbone.js 1.5.0
                        
                        //     (c) 2010-2022 Jeremy Ashkenas and DocumentCloud
                        //     Backbone may be freely distributed under the MIT license.
                        //     For all details and documentation:
                        Severity: Major
                        Found in wp-includes/js/backbone.js - About 3 days to fix

                          File plugin.js has 1271 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          (function () {
                          var media = (function () {
                              'use strict';
                          
                              var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
                          Severity: Major
                          Found in wp-includes/js/tinymce/plugins/media/plugin.js - About 3 days to fix

                            File plugin.js has 1261 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            (function () {
                            var charmap = (function () {
                                'use strict';
                            
                                var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
                            Severity: Major
                            Found in wp-includes/js/tinymce/plugins/charmap/plugin.js - About 3 days to fix

                              Function parse_query has a Cognitive Complexity of 161 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function parse_query( $query = '' ) {
                                      if ( ! empty( $query ) ) {
                                          $this->init();
                                          $this->query      = wp_parse_args( $query );
                                          $this->query_vars = $this->query;
                              Severity: Minor
                              Found in wp-includes/class-wp-query.php - About 3 days 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

                              Severity
                              Category
                              Status
                              Source
                              Language