gocodebox/lifterlms

View on GitHub

Showing 1,389 of 1,394 total issues

Similar blocks of code found in 16 locations. Consider refactoring.
Open

const Icon = () => (
    <SVG className="llms-block-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">
        <Path
            d="M592 416H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h544c26.5 0 48 21.5 48 48v224c0 26.5-21.5 48-48 48z"
        />
Severity: Major
Found in src/blocks/access-plan-button/icon.jsx and 15 other locations - About 50 mins to fix
src/blocks/checkout/icon.jsx on lines 5..11
src/blocks/course-author/icon.jsx on lines 5..11
src/blocks/course-continue/icon.jsx on lines 5..11
src/blocks/course-meta-info/icon.jsx on lines 5..11
src/blocks/course-outline/icon.jsx on lines 5..11
src/blocks/course-prerequisites/icon.jsx on lines 5..14
src/blocks/course-reviews/icon.jsx on lines 5..11
src/blocks/course-syllabus/icon.jsx on lines 5..14
src/blocks/courses/icon.jsx on lines 5..11
src/blocks/login/icon.jsx on lines 5..11
src/blocks/memberships/icon.jsx on lines 5..11
src/blocks/my-account/icon.jsx on lines 5..11
src/blocks/my-achievements/icon.jsx on lines 5..11
src/blocks/navigation-link/icon.jsx on lines 5..11
src/blocks/registration/icon.jsx on lines 5..10

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 51.

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

Similar blocks of code found in 16 locations. Consider refactoring.
Open

const Icon = () => (
    <SVG
        className="llms-block-icon"
        xmlns="http://www.w3.org/2000/svg"
        viewBox="0 0 512 512">
Severity: Major
Found in src/blocks/course-syllabus/icon.jsx and 15 other locations - About 50 mins to fix
src/blocks/access-plan-button/icon.jsx on lines 5..11
src/blocks/checkout/icon.jsx on lines 5..11
src/blocks/course-author/icon.jsx on lines 5..11
src/blocks/course-continue/icon.jsx on lines 5..11
src/blocks/course-meta-info/icon.jsx on lines 5..11
src/blocks/course-outline/icon.jsx on lines 5..11
src/blocks/course-prerequisites/icon.jsx on lines 5..14
src/blocks/course-reviews/icon.jsx on lines 5..11
src/blocks/courses/icon.jsx on lines 5..11
src/blocks/login/icon.jsx on lines 5..11
src/blocks/memberships/icon.jsx on lines 5..11
src/blocks/my-account/icon.jsx on lines 5..11
src/blocks/my-achievements/icon.jsx on lines 5..11
src/blocks/navigation-link/icon.jsx on lines 5..11
src/blocks/registration/icon.jsx on lines 5..10

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 51.

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

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

            $( '#llms-apply-coupon' ).on( 'click', function( e ) {

                e.preventDefault();
                self.coupon_apply( $( this ) );

Severity: Minor
Found in assets/js/llms-form-checkout.js and 1 other location - About 50 mins to fix
assets/js/llms-quiz.js on lines 397..400

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 51.

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

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

            $( '#llms-next-question, #llms-complete-quiz' ).on( 'click', function( e ) {
                e.preventDefault();
                self.answer_question( $( this ) );
            } );
Severity: Minor
Found in assets/js/llms-quiz.js and 1 other location - About 50 mins to fix
assets/js/llms-form-checkout.js on lines 179..184

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 51.

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        return array(
            array(
                'class'             => 'llms-select2',
                'custom_attributes' => array(
                    'data-allow-clear' => true,
includes/notifications/controllers/class.llms.notification.controller.purchase.receipt.php on lines 165..180
includes/notifications/controllers/class.llms.notification.controller.quiz.graded.php on lines 106..120
includes/notifications/controllers/class.llms.notification.controller.quiz.passed.php on lines 119..133
includes/notifications/controllers/class.llms.notification.controller.student.welcome.php on lines 140..154
includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php on lines 449..463

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 96.

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

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

                    array(
                        'data_attributes' => array(
                            'post-type'     => 'llms_membership',
                            'post-statuses' => 'publish,draft,future',
                            'placeholder'   => __( 'Memberships', 'lifterlms' ),
includes/admin/post-types/meta-boxes/class.llms.meta.box.voucher.php on lines 66..79

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 96.

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        return array(
            array(
                'class'             => 'llms-select2',
                'custom_attributes' => array(
                    'data-allow-clear' => true,
includes/notifications/controllers/class.llms.notification.controller.purchase.receipt.php on lines 165..180
includes/notifications/controllers/class.llms.notification.controller.quiz.failed.php on lines 118..132
includes/notifications/controllers/class.llms.notification.controller.quiz.graded.php on lines 106..120
includes/notifications/controllers/class.llms.notification.controller.student.welcome.php on lines 140..154
includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php on lines 449..463

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 96.

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

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

                    array(
                        'data_attributes' => array(
                            'post-type'     => 'course',
                            'post-statuses' => 'publish,draft,future',
                            'placeholder'   => __( 'Courses', 'lifterlms' ),
includes/admin/post-types/meta-boxes/class.llms.meta.box.voucher.php on lines 80..93

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 96.

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        return array(
            array(
                'class'             => 'llms-select2',
                'custom_attributes' => array(
                    'data-allow-clear' => true,
includes/notifications/controllers/class.llms.notification.controller.quiz.failed.php on lines 118..132
includes/notifications/controllers/class.llms.notification.controller.quiz.graded.php on lines 106..120
includes/notifications/controllers/class.llms.notification.controller.quiz.passed.php on lines 119..133
includes/notifications/controllers/class.llms.notification.controller.student.welcome.php on lines 140..154
includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php on lines 449..463

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 96.

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        return array(
            array(
                'class'             => 'llms-select2',
                'custom_attributes' => array(
                    'data-allow-clear' => true,
includes/notifications/controllers/class.llms.notification.controller.purchase.receipt.php on lines 165..180
includes/notifications/controllers/class.llms.notification.controller.quiz.failed.php on lines 118..132
includes/notifications/controllers/class.llms.notification.controller.quiz.graded.php on lines 106..120
includes/notifications/controllers/class.llms.notification.controller.quiz.passed.php on lines 119..133
includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php on lines 449..463

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 96.

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        return array(
            array(
                'class'             => 'llms-select2',
                'custom_attributes' => array(
                    'data-allow-clear' => true,
includes/notifications/controllers/class.llms.notification.controller.purchase.receipt.php on lines 165..180
includes/notifications/controllers/class.llms.notification.controller.quiz.failed.php on lines 118..132
includes/notifications/controllers/class.llms.notification.controller.quiz.passed.php on lines 119..133
includes/notifications/controllers/class.llms.notification.controller.student.welcome.php on lines 140..154
includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php on lines 449..463

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 96.

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        return array(
            array(
                'class'             => 'llms-select2',
                'custom_attributes' => array(
                    'data-allow-clear' => true,
includes/notifications/controllers/class.llms.notification.controller.purchase.receipt.php on lines 165..180
includes/notifications/controllers/class.llms.notification.controller.quiz.failed.php on lines 118..132
includes/notifications/controllers/class.llms.notification.controller.quiz.graded.php on lines 106..120
includes/notifications/controllers/class.llms.notification.controller.quiz.passed.php on lines 119..133
includes/notifications/controllers/class.llms.notification.controller.student.welcome.php on lines 140..154

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 96.

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 get_achievements_by_post has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_achievements_by_post( $post_ids, $include_children = true ) {

        if ( ! is_array( $post_ids ) ) {
            $post_ids = array( $post_ids );
        }
Severity: Minor
Found in includes/class.llms.achievements.php - About 45 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 action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    action: ( entries, { dir, silent, format } ) => {
        let all;

        try {
            all = getChangelogEntries( dir );
Severity: Minor
Found in packages/dev/src/cmds/changelog/validate.js - About 45 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 llms_get_post has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function llms_get_post( $post, $error = false ) {

    $post = get_post( $post );
    if ( ! $post ) {
        return $post;
Severity: Minor
Found in includes/llms.functions.core.php - About 45 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 action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    action: async ( { force, preid, build, yes } ) => {
        preid = preid ? ` --preid ${ preid }` : '';

        // Prepare release version.
        const version = force ? force : callSelf( `changelog version next${ preid }` );
Severity: Minor
Found in packages/dev/src/cmds/release/prepare.js - About 45 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 llms_anonymize_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_anonymize_string( $string, $char = '*' ) {

        if ( is_email( $string ) ) {
            $parts = explode( '@', $string );
            return llms_anonymize_string( $parts[0] ) . '@' . llms_anonymize_string( $parts[1] );
Severity: Minor
Found in includes/llms.functions.core.php - About 45 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 action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    action: ( { dir, preid, force, logFile, date, links, dryRun, keepEntries } ) => {
        try {
            date = formatDate( date );
        } catch ( e ) {
            logResult( 'Invalid date supplied. Please provide a date in YYYY-MM-DD format.', 'error' );
Severity: Minor
Found in packages/dev/src/cmds/changelog/write.js - About 45 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 admin_footer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function admin_footer( $text ) {

        global $current_screen;

        // Show footer on our custom post types in admin, but not on the block editor.
Severity: Minor
Found in includes/admin/class-llms-admin-review.php - About 45 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 output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function output() {

        global $post;

        parent::output(); ?>

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