CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/includes/misc.php

Summary

Maintainability
F
3 days
Test Coverage

Function insert_with_markers has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

function insert_with_markers( $filename, $marker, $insertion ) {
    if (!file_exists( $filename ) || is_writeable( $filename ) ) {
        if (!file_exists( $filename ) ) {
            $markerdata = '';
        } else {
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 7 hrs 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 misc.php has 380 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Misc WordPress Administration API.
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 5 hrs to fix

    Function wp_doc_link_parse has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_doc_link_parse( $content ) {
        if ( !is_string( $content ) || empty( $content ) )
            return array();
    
        if ( !function_exists('token_get_all') )
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 2 hrs 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 iis7_add_rewrite_rule has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    function iis7_add_rewrite_rule($filename, $rewrite_rule) {
        if ( ! class_exists('DOMDocument') )
            return false;
    
        // If configuration file does not exist then we create one.
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 2 hrs 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 iis7_add_rewrite_rule has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function iis7_add_rewrite_rule($filename, $rewrite_rule) {
        if ( ! class_exists('DOMDocument') )
            return false;
    
        // If configuration file does not exist then we create one.
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 2 hrs to fix

      Function set_screen_options has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      function set_screen_options() {
      
          if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
              check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 1 hr 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 insert_with_markers has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function insert_with_markers( $filename, $marker, $insertion ) {
          if (!file_exists( $filename ) || is_writeable( $filename ) ) {
              if (!file_exists( $filename ) ) {
                  $markerdata = '';
              } else {
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 1 hr to fix

        Function wp_reset_vars has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        function wp_reset_vars( $vars ) {
            for ( $i=0; $i<count( $vars ); $i += 1 ) {
                $var = $vars[$i];
                global $$var;
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 1 hr 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 set_screen_options has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function set_screen_options() {
        
            if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
                check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 1 hr to fix

          Method wp_doc_link_parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wp_doc_link_parse( $content ) {
              if ( !is_string( $content ) || empty( $content ) )
                  return array();
          
              if ( !function_exists('token_get_all') )
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 1 hr to fix

            Function extract_from_markers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function extract_from_markers( $filename, $marker ) {
                $result = array ();
            
                if (!file_exists( $filename ) ) {
                    return $result;
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 55 mins 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 iis7_save_url_rewrite_rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function iis7_save_url_rewrite_rules(){
                global $wp_rewrite;
            
                $home_path = get_home_path();
                $web_config_file = $home_path . 'web.config';
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 55 mins 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 win_is_writable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function win_is_writable($path) {
                /* will work in despite of Windows ACLs bug
                 * NOTE: use a trailing slash for folders!!!
                 * see http://bugs.php.net/bug.php?id=27609
                 * see http://bugs.php.net/bug.php?id=30931
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 45 mins 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

            Avoid too many return statements within this method.
            Open

                    return true;
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/includes/misc.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status