gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Function lost_password has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function lost_password() {

        // Invalid nonce or the form wasn't submitted.
        if ( ! llms_verify_nonce( '_lost_password_nonce', 'llms_lost_password', 'POST' ) ) {
            return null;
Severity: Minor
Found in includes/forms/controllers/class.llms.controller.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

Function get_fields_settings_from_blocks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_fields_settings_from_blocks( $blocks ) {

        $fields = array();
        $blocks = $this->get_field_blocks( $blocks );

Severity: Minor
Found in includes/forms/class-llms-forms.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 llms_update_user_postmeta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_update_user_postmeta( $user_id, $post_id, $meta_key, $meta_value, $unique = true ) {

        $item = false;

        // if unique is true, make an update to the existing item (if it exists).
Severity: Minor
Found in includes/functions/llms.functions.user.postmeta.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 llms_delete_user_postmeta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_delete_user_postmeta( $user_id, $post_id, $meta_key = null, $meta_value = null ) {

        $ret = false;

        $existing = _llms_query_user_postmeta( $user_id, $post_id, $meta_key, maybe_unserialize( $meta_value ) );
Severity: Minor
Found in includes/functions/llms.functions.user.postmeta.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 _llms_add_user_info_to_merge_buttons has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function _llms_add_user_info_to_merge_buttons( $codes, $screen ) {

    if ( $screen && ! empty( $screen->post_type ) && in_array( $screen->post_type, array( 'llms_certificate', 'llms_email' ), true ) ) {

        foreach ( llms_get_user_information_fields_for_editor() as $field ) {
Severity: Minor
Found in includes/functions/llms-functions-user-information-fields.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 set_merge_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_merge_data( $code ) {

        $order = $this->post;

        switch ( $code ) {

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

    public function maybe_update_relationships( $post_id ) {

        $post = get_post( $post_id );
        if ( ! in_array( $post->post_type, $this->get_post_types(), true ) ) {
            return;
Severity: Minor
Found in includes/class.llms.post.relationships.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

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

        $.each( defaults, function( setting ) {
            if ( self.attr( 'data-' + setting ) ) {
                options[ setting ] = self.attr( 'data-' + setting );
            }
        } );
Severity: Major
Found in assets/js/llms-admin.js and 1 other location - About 1 hr to fix
assets/js/llms-admin.js on lines 67..71

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

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

function llms_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {

    // Map endpoint to options.
    $vars     = llms()->query->get_query_vars();
    $endpoint = $vars[ $endpoint ] ?? $endpoint;
Severity: Minor
Found in includes/functions/llms.functions.page.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

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

        $.each( defaults, function( setting ) {
            if ( self.attr( 'data-' + setting ) ) {
                options[ setting ] = self.attr( 'data-' + setting );
            }
        } );
Severity: Major
Found in assets/js/llms-admin.js and 1 other location - About 1 hr to fix
assets/js/llms-admin.js on lines 181..185

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

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

    function llms_get_post_content( $content ) {

        global $post;
        if ( ! $post instanceof WP_Post ) {
            return $content;
Severity: Minor
Found in includes/functions/llms-functions-content.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

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

        update_order: function() {

            var self = this;

            this.each( function( section ) {
Severity: Major
Found in assets/js/builder/Collections/Sections.js and 1 other location - About 1 hr to fix
assets/js/builder/Collections/Questions.js on lines 45..55

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

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

        update_order: function() {

            var self = this;

            this.each( function( question ) {
Severity: Major
Found in assets/js/builder/Collections/Questions.js and 1 other location - About 1 hr to fix
assets/js/builder/Collections/Sections.js on lines 45..55

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

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

                                    return <Button
                                        key={ value }
                                        isPrimary={ value === attributes.layout }
                                        onClick={ () => setAttributes( {
                                            layout: value,
Severity: Major
Found in src/blocks/login/index.jsx and 1 other location - About 1 hr to fix
src/blocks/access-plan-button/index.jsx on lines 121..135

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

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

                                        return (
                                            <Button
                                                key={ value }
                                                isPrimary={
                                                    value === attributes.size
Severity: Major
Found in src/blocks/access-plan-button/index.jsx and 1 other location - About 1 hr to fix
src/blocks/login/index.jsx on lines 52..60

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

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

export function start( selector, size = SIZE_DEFAULT ) {
    ensureElementList( selector ).forEach( ( el ) => {
        const spinner = get( el, size, false );
        if ( spinner ) {
            spinner.style.display = 'block';
Severity: Major
Found in packages/components/src/spinner/index.js and 1 other location - About 1 hr to fix
packages/components/src/spinner/index.js on lines 82..89

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

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

export function stop( selector ) {
    ensureElementList( selector ).forEach( ( el ) => {
        const spinner = get( el, SIZE_DEFAULT, false );
        if ( spinner ) {
            spinner.style.display = 'none';
Severity: Major
Found in packages/components/src/spinner/index.js and 1 other location - About 1 hr to fix
packages/components/src/spinner/index.js on lines 64..71

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

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 ViewManager has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var ViewManager = function() {

        var currentView = 'self',
            currentNonce;

Severity: Minor
Found in assets/js/llms-view-manager.js - About 1 hr to fix

    Function toMatchStringWithQuotes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async toMatchStringWithQuotes( received, expected ) {
            received = received.replace( /[“”]/g, '"' ).replace( /[‘’]/g, "'" );
    
            const options = {
                comment: 'String with quotes equality',
    Severity: Minor
    Found in packages/scripts/e2e/bootstrap.js - About 1 hr to fix

      Function bind has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              this.bind = function() {
      
                  var self = this;
      
                  this.$tables.each( function() {
      Severity: Minor
      Found in assets/js/llms-admin-tables.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language