lightspeeddevelopment/lsx-health-plan

View on GitHub

Showing 9,134 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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
 * The template for displaying Recipe Type Archives.
 *
 * @package lsx-health-plan
Severity: Major
Found in templates/taxonomy-recipe-type.php and 2 other locations - About 3 hrs to fix
templates/archive-recipe.php on lines 1..53
templates/taxonomy-recipe-cuisine.php on lines 1..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 148.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
 * The template for displaying Recipes Archive.
 *
 * @package lsx-health-plan
Severity: Major
Found in templates/archive-recipe.php and 2 other locations - About 3 hrs to fix
templates/taxonomy-recipe-cuisine.php on lines 1..53
templates/taxonomy-recipe-type.php on lines 1..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 148.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
 * The template for displaying Recipe Cuisine Archives.
 *
 * @package lsx-health-plan
Severity: Major
Found in templates/taxonomy-recipe-cuisine.php and 2 other locations - About 3 hrs to fix
templates/archive-recipe.php on lines 1..53
templates/taxonomy-recipe-type.php on lines 1..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 148.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                            if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) {
                                $link_html  = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">';
                                $link_close = '</a>';
                                // We call the button to register the alt modal, but we do not output it.
                                lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image );
Severity: Major
Found in templates/partials/workout-grid.php and 1 other location - About 2 hrs to fix
templates/partials/workout-list.php on lines 82..92

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 141.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                                if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) {
                                    $link_html  = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">';
                                    $link_close = '</a>';
                                    // We call the button to register the alt modal, but we do not output it.
                                    lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image );
Severity: Major
Found in templates/partials/workout-list.php and 1 other location - About 2 hrs to fix
templates/partials/workout-grid.php on lines 90..100

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 141.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Don't use IDs in selectors.
Open

.plan_page_help #wpbody .box p, .plan_page_help #wpbody .box ul { font-size: 13px; }
Severity: Minor
Found in assets/css/help-rtl.css by csslint

Don't use IDs in selectors.
Open

.plan_page_help #wpbody .box p:last-child, .plan_page_help #wpbody .box ul:last-child { margin-bottom: 0; }
Severity: Minor
Found in assets/css/help-rtl.css by csslint

Adjoining classes: .plan_page_help #wpbody .box.info:before
Open

.plan_page_help #wpbody .box.info:before { content: '\f534'; }
Severity: Minor
Found in assets/css/help-rtl.css by csslint

Adjoining classes: .plan_page_help #wpbody .box.news:before
Open

.plan_page_help #wpbody .box.news:before { content: '\f319'; }
Severity: Minor
Found in assets/css/help-rtl.css by csslint

Rule doesn't have all its properties in alphabetical order.
Open

.plan_page_help #wpbody .box:before { content: '\f324'; display: block; position: absolute; top: 30px; right: 30px; font-size: 1.618em; font-family: 'Dashicons'; font-weight: 400; -webkit-font-smoothing: antialiased; }
Severity: Minor
Found in assets/css/help.css by csslint

Adjoining classes: .plan_page_help #wpbody .box.news:before
Open

.plan_page_help #wpbody .box.news:before { content: '\f319'; }
Severity: Minor
Found in assets/css/help.css by csslint

Adjoining classes: .wp-admin.plan_page_lsx_health_plan_options .wp-filter .filter-links > li > a
Open

.wp-admin.plan_page_lsx_health_plan_options .wp-filter .filter-links > li > a { color: #0073aa; border-bottom: none; margin: 2px; }
Severity
Category
Status
Source
Language