wp-global-admin.php
Function ga_init
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
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';
- Read upRead up
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
Open
function ga_requirements_notice() {
$plugin_file = plugin_basename( __FILE__ );
if ( ! current_user_can( 'deactivate_plugin', $plugin_file ) ) {
return;
Avoid unused local variables such as '$plugin_file'. Open
Open
$plugin_file = plugin_basename( __FILE__ );
- Read upRead up
- Exclude checks
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
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' ),
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'. Open
Open
__( 'Please note: WP Global Admin requires WordPress 4.9 or higher. <a href="%s">Deactivate plugin</a>.', 'wp-global-admin' ),
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'wp_nonce_url'. Open
Open
wp_nonce_url(
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'wp_nonce_url'. Open
Open
wp_nonce_url(
- Exclude checks