CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/install-helper.php

Summary

Maintainability
C
1 day
Test Coverage

Function check_column has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
    global $wpdb, $debug;
    $diffs = 0;
    $results = $wpdb->get_results("DESC $table_name");

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/install-helper.php - About 4 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 maybe_add_column has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function maybe_add_column($table_name, $column_name, $create_ddl) {
    global $wpdb, $debug;
    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
        if ($debug) echo("checking $column == $column_name<br />");

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/install-helper.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 check_column has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
    global $wpdb, $debug;
    $diffs = 0;
    $results = $wpdb->get_results("DESC $table_name");

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/install-helper.php - About 1 hr to fix

    Function maybe_drop_column has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    function maybe_drop_column($table_name, $column_name, $drop_ddl) {
        global $wpdb;
        foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
            if ($column == $column_name) {
                //found it try to drop it.
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/install-helper.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

    Function maybe_create_table has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
        foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
            if ($table == $table_name) {
                return true;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/install-helper.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 check_column has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/install-helper.php - About 50 mins to fix

      There are no issues that match your filters.

      Category
      Status