skyverge/wc-plugin-framework

View on GitHub
woocommerce/class-sv-wc-framework-bootstrap.php

Summary

Maintainability
C
1 day
Test Coverage

Function load_framework_plugins has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function load_framework_plugins() {

        // first sort the registered plugins by framework version
        usort( $this->registered_plugins, array( $this, 'compare_frameworks' ) );

Severity: Minor
Found in woocommerce/class-sv-wc-framework-bootstrap.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 render_update_notices has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function render_update_notices() {

        // must update plugin notice
        if ( ! empty( $this->incompatible_framework_plugins ) ) {

Severity: Minor
Found in woocommerce/class-sv-wc-framework-bootstrap.php - About 2 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_deactivate_framework_plugins has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_deactivate_framework_plugins() {

        if ( isset( $_GET['sv_wc_framework_deactivate_newer'] ) ) {
            if ( 'yes' == $_GET['sv_wc_framework_deactivate_newer'] ) {

Severity: Minor
Found in woocommerce/class-sv-wc-framework-bootstrap.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 render_update_notices has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render_update_notices() {

        // must update plugin notice
        if ( ! empty( $this->incompatible_framework_plugins ) ) {

Severity: Minor
Found in woocommerce/class-sv-wc-framework-bootstrap.php - About 1 hr to fix

    Method load_framework_plugins has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function load_framework_plugins() {
    
            // first sort the registered plugins by framework version
            usort( $this->registered_plugins, array( $this, 'compare_frameworks' ) );
    
    
    Severity: Minor
    Found in woocommerce/class-sv-wc-framework-bootstrap.php - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if ( ( $this->incompatible_framework_plugins || $this->incompatible_wc_version_plugins || $this->incompatible_wp_version_plugins ) && is_admin() && ! defined( 'DOING_AJAX' ) && ! has_action( 'admin_notices', array( $this, 'render_update_notices' ) ) ) {
      
                  add_action( 'admin_notices', array( $this, 'render_update_notices' ) );
              }
      Severity: Major
      Found in woocommerce/class-sv-wc-framework-bootstrap.php - About 40 mins to fix

        Method register_plugin has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function register_plugin( $version, $plugin_name, $path, $callback, $args = array() ) {
        Severity: Minor
        Found in woocommerce/class-sv-wc-framework-bootstrap.php - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status