felixarntz/global-admin

View on GitHub
wp-global-admin.php

Summary

Maintainability
A
2 hrs
Test Coverage

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

function ga_init() {
    if ( function_exists( 'go_init' ) ) {
        require_once GA_PATH . 'wp-global-admin/wp-includes/load.php';
        require_once GA_PATH . 'wp-global-admin/wp-includes/capabilities.php';
        require_once GA_PATH . 'wp-global-admin/wp-includes/link-template.php';
Severity: Minor
Found in wp-global-admin.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 ga_requirements_notice has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ga_requirements_notice() {
    $plugin_file = plugin_basename( __FILE__ );

    if ( ! current_user_can( 'deactivate_plugin', $plugin_file ) ) {
        return;
Severity: Minor
Found in wp-global-admin.php - About 1 hr to fix

    Avoid unused local variables such as '$plugin_file'.
    Open

        $plugin_file = plugin_basename( __FILE__ );
    Severity: Minor
    Found in wp-global-admin.php by phpmd

    UnusedLocalVariable

    Since: 0.2

    Detects when a local variable is declared and/or assigned, but not used.

    Example

    class Foo {
        public function doSomething()
        {
            $i = 5; // Unused
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

    All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
    Open

                    __( 'Please note: WP Global Admin requires the WP Global Options plugin to be installed and activated. <a href="%s">Install plugin</a>.', 'wp-global-admin' ),
    Severity: Minor
    Found in wp-global-admin.php by phpcodesniffer

    All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
    Open

                    __( 'Please note: WP Global Admin requires WordPress 4.9 or higher. <a href="%s">Deactivate plugin</a>.', 'wp-global-admin' ),
    Severity: Minor
    Found in wp-global-admin.php by phpcodesniffer

    All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'wp_nonce_url'.
    Open

                    wp_nonce_url(
    Severity: Minor
    Found in wp-global-admin.php by phpcodesniffer

    All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'wp_nonce_url'.
    Open

                    wp_nonce_url(
    Severity: Minor
    Found in wp-global-admin.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status