lightspeeddevelopment/lsx-health-plan

View on GitHub

Showing 8 of 9,134 total issues

Function lsx_health_plan_my_profile_box has a Cognitive Complexity of 65 (exceeds 25 allowed). Consider refactoring.
Open

function lsx_health_plan_my_profile_box() {
    ?>
    <div class="lsx-health-plan my-profile-block wp-block-cover alignfull">
        <div class="wp-block-cover__inner-container">
            <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2>
Severity: Minor
Found in includes/template-tags.php - About 6 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 lsx_health_plan_week_plan_block has a Cognitive Complexity of 49 (exceeds 25 allowed). Consider refactoring.
Open

function lsx_health_plan_week_plan_block( $args = array() ) {
    $defaults = array(
        'show_downloads' => false,
        'plan'           => '',
    );
Severity: Minor
Found in includes/template-tags.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 index_exercises has a Cognitive Complexity of 46 (exceeds 25 allowed). Consider refactoring.
Open

    public function index_exercises( $row ) {
        if ( empty( $this->current_plan_ids ) ) {
            return;
        }
        $i                  = 1;
Severity: Minor
Found in classes/integrations/facetwp/class-connected-plans.php - About 3 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 lsx_to_scporder_pre_get_posts has a Cognitive Complexity of 41 (exceeds 25 allowed). Consider refactoring.
Open

    public function lsx_to_scporder_pre_get_posts( $wp_query ) {
        $objects = $this->get_to_scporder_options_objects();

        if ( empty( $objects ) ) {
            return false;
Severity: Minor
Found in classes/class-scpo-engine.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 lsx_health_plan_all_plans_block has a Cognitive Complexity of 37 (exceeds 25 allowed). Consider refactoring.
Open

function lsx_health_plan_all_plans_block() {
    global $post, $product;

    // If this is the my plan page, and the user is logged out, show to WC login.
    $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
Severity: Minor
Found in includes/template-tags.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 get_downloads has a Cognitive Complexity of 34 (exceeds 25 allowed). Consider refactoring.
Open

function get_downloads( $type = 'all', $post_id = '' ) {
    $lsx_health_plan = \lsx_health_plan();
    $post_types      = $lsx_health_plan->get_post_types();
    if ( '' === $post_id ) {
        $post_id = get_the_ID();
Severity: Minor
Found in includes/functions.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 lsx_health_plan_workout_exercise_alt_button has a Cognitive Complexity of 33 (exceeds 25 allowed). Consider refactoring.
Open

function lsx_health_plan_workout_exercise_alt_button( $m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image ) {
    $defaults = array(
        'modal_trigger' => 'button',
        'modal_content' => 'excerpt',
    );
Severity: Minor
Found in includes/template-tags/exercise.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 lsx_profile_photo_field_filter has a Cognitive Complexity of 31 (exceeds 25 allowed). Consider refactoring.
Open

    public function lsx_profile_photo_field_filter( $field, $key, $args, $value ) {
        if ( 'profile_photo' === $args['id'] ) {

            if ( $args['required'] ) {
                $args['class'][] = 'validate-required';
Severity: Minor
Found in classes/integrations/woocommerce/class-account.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

Severity
Category
Status
Source
Language