WordPress/WordPress

View on GitHub

Showing 10,370 of 14,330 total issues

File blocks.php has 1174 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Functions related to registering and parsing blocks.
 *
 * @package WordPress
Severity: Major
Found in wp-includes/blocks.php - About 3 days to fix

    Function prepare_query has a Cognitive Complexity of 148 (exceeds 5 allowed). Consider refactoring.
    Open

        public function prepare_query( $query = array() ) {
            global $wpdb, $wp_roles;
    
            if ( empty( $this->query_vars ) || ! empty( $query ) ) {
                $this->query_limit = null;
    Severity: Minor
    Found in wp-includes/class-wp-user-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

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

    <?php
    /**
     * Comment template functions
     *
     * These functions are meant to live inside of the WordPress loop.
    Severity: Major
    Found in wp-includes/comment-template.php - About 3 days to fix

      Function SwitchEditors has 599 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function SwitchEditors() {
              var tinymce, $$,
                  exports = {};
      
              function init() {
      Severity: Major
      Found in wp-admin/js/editor.js - About 2 days to fix

        File class-wp-theme.php has 1162 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * WP_Theme Class
         *
         * @package WordPress
        Severity: Major
        Found in wp-includes/class-wp-theme.php - About 2 days to fix

          Function ajaxSubmit has 596 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.fn.ajaxSubmit = function(options, data, dataType, onSuccess) {
                  // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
                  if (!this.length) {
                      log('ajaxSubmit: skipping submit process - no element selected');
          
          
          Severity: Major
          Found in wp-includes/js/jquery/jquery.form.js - About 2 days to fix

            Method wp_default_scripts has 595 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wp_default_scripts( $scripts ) {
                $suffix     = wp_scripts_get_suffix();
                $dev_suffix = wp_scripts_get_suffix( 'dev' );
                $guessurl   = site_url();
            
            
            Severity: Major
            Found in wp-includes/script-loader.php - About 2 days to fix

              Method map_meta_cap has 594 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function map_meta_cap( $cap, $user_id, ...$args ) {
                  $caps = array();
              
                  switch ( $cap ) {
                      case 'remove_user':
              Severity: Major
              Found in wp-includes/capabilities.php - About 2 days to fix

                File sortable.js has 1151 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*!
                 * jQuery UI Sortable 1.13.3
                 * https://jqueryui.com
                 *
                 * Copyright OpenJS Foundation and other contributors
                Severity: Major
                Found in wp-includes/js/jquery/ui/sortable.js - About 2 days to fix

                  File meta-boxes.php has 1151 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * WordPress Administration Meta Boxes API.
                   *
                   * @package WordPress
                  Severity: Major
                  Found in wp-admin/includes/meta-boxes.php - About 2 days to fix

                    File getid3.lib.php has 1150 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/getid3.lib.php - About 2 days to fix

                      Function get_terms has a Cognitive Complexity of 145 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function get_terms() {
                              global $wpdb;
                      
                              $this->parse_query( $this->query_vars );
                              $args = &$this->query_vars;
                      Severity: Minor
                      Found in wp-includes/class-wp-term-query.php - About 2 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 17 has 586 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      },{"./Pseudos":12,"./SelectorPart":14}],17:[function(require,module,exports){
                      "use strict";
                      
                      module.exports = TokenStream;
                      
                      
                      Severity: Major
                      Found in wp-includes/js/codemirror/csslint.js - About 2 days to fix

                        Function __construct has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $curl_options = array())
                            {
                                if (class_exists('idna_convert'))
                                {
                                    $idn = new idna_convert();
                        Severity: Minor
                        Found in wp-includes/SimplePie/File.php - About 2 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 parseEBML has 579 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function parseEBML(&$info) {
                                // http://www.matroska.org/technical/specs/index.html#EBMLBasics
                                $this->current_offset = $info['avdataoffset'];
                        
                                while ($this->getEBMLelement($top_element, $info['avdataend'])) {
                        Severity: Major
                        Found in wp-includes/ID3/module.audio-video.matroska.php - About 2 days to fix

                          Function inline_edit has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function inline_edit() {
                                  global $mode;
                          
                                  $screen = $this->screen;
                          
                          
                          Severity: Minor
                          Found in wp-admin/includes/class-wp-posts-list-table.php - About 2 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 get_comment_ids has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function get_comment_ids() {
                                  global $wpdb;
                          
                                  // Assemble clauses related to 'comment_approved'.
                                  $approved_clauses = array();
                          Severity: Minor
                          Found in wp-includes/class-wp-comment-query.php - About 2 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 class-wp-customize-widgets.php has 1126 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /**
                           * WordPress Customize Widgets classes
                           *
                           * @package WordPress
                          Severity: Major
                          Found in wp-includes/class-wp-customize-widgets.php - About 2 days to fix

                            Method redirect_canonical has 575 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function redirect_canonical( $requested_url = null, $do_redirect = true ) {
                                global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
                            
                                if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ), true ) ) {
                                    return;
                            Severity: Major
                            Found in wp-includes/canonical.php - About 2 days to fix

                              File nav-menu.php has 1117 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              /**
                               * Core Navigation Menu API
                               *
                               * @package WordPress
                              Severity: Major
                              Found in wp-admin/includes/nav-menu.php - About 2 days to fix
                                Severity
                                Category
                                Status
                                Source
                                Language