WordPress/WordPress

View on GitHub

Showing 10,370 of 14,330 total issues

Function map_meta_cap has a Cognitive Complexity of 215 (exceeds 5 allowed). Consider refactoring.
Open

function map_meta_cap( $cap, $user_id, ...$args ) {
    $caps = array();

    switch ( $cap ) {
        case 'remove_user':
Severity: Minor
Found in wp-includes/capabilities.php - About 4 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 template.php has 1618 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Template WordPress Administration API.
 *
 * A Big Mess. Also some neat functions that are nicely written.
Severity: Major
Found in wp-admin/includes/template.php - About 4 days to fix

    File kses.php has 1601 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
     * Copyright (C) 2002, 2003, 2005  Ulf Harnhammar
     *
    Severity: Major
    Found in wp-includes/kses.php - About 4 days to fix

      Function import_theme_starter_content has a Cognitive Complexity of 209 (exceeds 5 allowed). Consider refactoring.
      Open

          public function import_theme_starter_content( $starter_content = array() ) {
              if ( empty( $starter_content ) ) {
                  $starter_content = get_theme_starter_content();
              }
      
      
      Severity: Minor
      Found in wp-includes/class-wp-customize-manager.php - About 4 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 file.php has 1539 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Filesystem API: Top-level functionality
       *
       * Functions for reading, writing, modifying, and deleting files on the file system.
      Severity: Major
      Found in wp-admin/includes/file.php - About 4 days to fix

        File post.php has 1533 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * WordPress Post Administration API.
         *
         * @package WordPress
        Severity: Major
        Found in wp-admin/includes/post.php - About 4 days to fix

          Function Uploader has 810 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          plupload.Uploader = function(options) {
              /**
              Fires when the current RunTime has been initialized.
              
              @event Init
          Severity: Major
          Found in wp-includes/js/plupload/plupload.js - About 4 days to fix

            File module.audio.mp3.php has 1494 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /////////////////////////////////////////////////////////////////
            /// getID3() by James Heinrich <info@getid3.org>               //
            //  available at https://github.com/JamesHeinrich/getID3       //
            Severity: Major
            Found in wp-includes/ID3/module.audio.mp3.php - About 3 days to fix

              Function parse_microformats has a Cognitive Complexity of 193 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function parse_microformats(&$data, $url) {
                      $feed_title = '';
                      $feed_author = NULL;
                      $author_cache = array();
                      $items = array();
              Severity: Minor
              Found in wp-includes/SimplePie/Parser.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 module.audio-video.asf.php has 1481 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /////////////////////////////////////////////////////////////////
              /// getID3() by James Heinrich <info@getid3.org>               //
              //  available at https://github.com/JamesHeinrich/getID3       //
              //            or https://www.getid3.org                        //
              Severity: Major
              Found in wp-includes/ID3/module.audio-video.asf.php - About 3 days to fix

                File H.php has 1480 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                if (class_exists('ParagonIE_Sodium_Core_Curve25519_H', false)) {
                    return;
                }
                Severity: Major
                Found in wp-includes/sodium_compat/src/Core/Curve25519/H.php - About 3 days to fix

                  File module.audio-video.matroska.php has 1472 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /////////////////////////////////////////////////////////////////
                  /// getID3() by James Heinrich <info@getid3.org>               //
                  //  available at https://github.com/JamesHeinrich/getID3       //
                  Severity: Major
                  Found in wp-includes/ID3/module.audio-video.matroska.php - About 3 days to fix

                    Function update_core has a Cognitive Complexity of 191 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function update_core( $from, $to ) {
                        global $wp_filesystem, $_old_files, $_old_requests_files, $_new_bundled_files, $wpdb;
                    
                        if ( function_exists( 'set_time_limit' ) ) {
                            set_time_limit( 300 );
                    Severity: Minor
                    Found in wp-admin/includes/update-core.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 wp_insert_post has a Cognitive Complexity of 191 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) {
                        global $wpdb;
                    
                        // Capture original pre-sanitized array for passing into filters.
                        $unsanitized_postarr = $postarr;
                    Severity: Minor
                    Found in wp-includes/post.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 getid3.php has 1446 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /////////////////////////////////////////////////////////////////
                    /// getID3() by James Heinrich <info@getid3.org>               //
                    //  available at https://github.com/JamesHeinrich/getID3       //
                    //            or https://www.getid3.org                        //
                    Severity: Major
                    Found in wp-includes/ID3/getid3.php - About 3 days to fix

                      File underscore.js has 1445 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      (function (global, factory) {
                        typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
                        typeof define === 'function' && define.amd ? define('underscore', factory) :
                        (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
                          var current = global._;
                      Severity: Major
                      Found in wp-includes/js/underscore.js - About 3 days to fix

                        File customize-widgets.js has 1435 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * @output wp-admin/js/customize-widgets.js
                         */
                        
                        /* global _wpCustomizeWidgetsSettings */
                        Severity: Major
                        Found in wp-admin/js/customize-widgets.js - About 3 days to fix

                          Function 11 has a Cognitive Complexity of 186 (exceeds 5 allowed). Consider refactoring.
                          Open

                          },{"16":16,"2":2,"26":26,"27":27,"5":5}],11:[function(_dereq_,module,exports){
                          'use strict';
                          
                          var _document = _dereq_(2);
                          
                          
                          Severity: Minor
                          Found in wp-includes/js/mediaelement/mediaelement-and-player.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

                          File H.php has 1431 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          if (class_exists('ParagonIE_Sodium_Core32_Curve25519_H', false)) {
                              return;
                          }
                          Severity: Major
                          Found in wp-includes/sodium_compat/src/Core32/Curve25519/H.php - About 3 days to fix

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

                                public function Analyze()
                                {
                                    $info = &$this->getid3->info;
                            
                                    // parse container
                            Severity: Minor
                            Found in wp-includes/ID3/module.audio-video.matroska.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