skyverge/wc-plugin-framework

View on GitHub
woocommerce/Lifecycle.php

Summary

Maintainability
B
6 hrs
Test Coverage

Lifecycle has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

#[\AllowDynamicProperties]
class Lifecycle {


    /** @var array the version numbers that have an upgrade routine */
Severity: Minor
Found in woocommerce/Lifecycle.php - About 2 hrs to fix

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

        public function add_admin_notices() {
    
            // display any milestone notices
            foreach ( $this->get_milestone_messages() as $id => $message ) {
    
    
    Severity: Minor
    Found in woocommerce/Lifecycle.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 init has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function init() {
    
            // potentially handle a new activation
            $this->handle_activation();
    
    
    Severity: Minor
    Found in woocommerce/Lifecycle.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 handle_deactivation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle_deactivation() {
    
            // if the enhanced admin is available, delete all of this plugin's notes on deactivation
            if ( SV_WC_Plugin_Compatibility::is_enhanced_admin_available() ) {
    
    
    Severity: Minor
    Found in woocommerce/Lifecycle.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 upgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function upgrade( $installed_version ) {
    
            foreach ( $this->upgrade_versions as $upgrade_version ) {
    
                $upgrade_method = 'upgrade_to_' . str_replace( array( '.', '-' ), '_', $upgrade_version );
    Severity: Minor
    Found in woocommerce/Lifecycle.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