skyverge/wc-plugin-framework

View on GitHub
woocommerce/class-sv-wc-hook-deprecator.php

Summary

Maintainability
A
2 hrs
Test Coverage

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

    public function trigger_deprecated_errors() {
        global $wp_filter;

        // follow WP core behavior for showing deprecated notices and only do so when WP_DEBUG is on
        if ( defined( 'WP_DEBUG' ) && WP_DEBUG && apply_filters( 'sv_wc_plugin_framework_show_deprecated_hook_notices', true ) ) {
Severity: Minor
Found in woocommerce/class-sv-wc-hook-deprecator.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 map_deprecated_hooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function map_deprecated_hooks() {

        foreach ( $this->hooks as $old_hook => $hook ) {

            if ( ! empty( $hook['replacement'] ) && $hook['removed'] && $hook['map'] ) {
Severity: Minor
Found in woocommerce/class-sv-wc-hook-deprecator.php - About 25 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

There are no issues that match your filters.

Category
Status