gocodebox/lifterlms

View on GitHub

Showing 1,389 of 1,394 total issues

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

            $toggle.on( 'click', function( e ) {
                e.preventDefault();
                $radios.slideDown( 'fast' );
                $toggle.hide();
            } );
Severity: Minor
Found in assets/js/llms-metabox-product.js and 1 other location - About 40 mins to fix
assets/js/llms-metabox-product.js on lines 322..326

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

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

            if ( ! existsSync( archive ) ) {
                logResult( `The distribution file ${ chalk.bold( archive ) } doesn't exist.`, 'error' );
                process.exit( 1 );
            }
Severity: Minor
Found in packages/dev/src/cmds/release/create.js and 1 other location - About 40 mins to fix
packages/dev/src/cmds/meta/parse.js on lines 18..21

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

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

            $cancel.on( 'click', function( e ) {
                e.preventDefault();
                $radios.slideUp( 'fast' );
                $toggle.show();
            } );
Severity: Minor
Found in assets/js/llms-metabox-product.js and 1 other location - About 40 mins to fix
assets/js/llms-metabox-product.js on lines 309..313

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

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

        if ( ! existsSync( file ) ) {
            logResult( `Invalid file: "${ chalk.bold( file ) }".`, 'error' );
            process.exit( 1 );
        }
Severity: Minor
Found in packages/dev/src/cmds/meta/parse.js and 1 other location - About 40 mins to fix
packages/dev/src/cmds/release/create.js on lines 74..77

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

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

            case 'instructors':
                $data = array();
                foreach ( $membership->get_instructors() as $info ) {
                    $instructor = llms_get_instructor( $info['id'] );
                    if ( $instructor ) {
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.memberships.php and 1 other location - About 40 mins to fix
includes/admin/reporting/tables/llms.table.courses.php on lines 110..119

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

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

            case 'instructors':
                $data = array();
                foreach ( $course->get_instructors() as $info ) {
                    $instructor = llms_get_instructor( $info['id'] );
                    if ( $instructor ) {
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.courses.php and 1 other location - About 40 mins to fix
includes/admin/reporting/tables/llms.table.memberships.php on lines 122..131

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

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

            'assignment'  => array(
                'action'           => 'edit-assignment',
                'active_condition' => "'yes' === data.get( 'assignment_enabled' )",
                'tip'              => esc_attr__( 'Add an assignment', 'lifterlms' ),
                'tip_active'       => sprintf( esc_attr__( 'Edit assignment: %s', 'lifterlms' ), "{{{ _.isEmpty( data.get( 'assignment' ) ) ? '' : data.get( 'assignment' ).get( 'title' ) }}}" ),
Severity: Minor
Found in includes/admin/views/builder/lesson.php and 1 other location - About 40 mins to fix
includes/admin/views/builder/lesson.php on lines 103..110

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

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

            'quiz'        => array(
                'action'           => 'edit-quiz',
                'active_condition' => "'yes' === data.get( 'quiz_enabled' )",
                'tip'              => esc_attr__( 'Add a quiz', 'lifterlms' ),
                'tip_active'       => sprintf( esc_attr__( 'Edit quiz: %s', 'lifterlms' ), "{{{ ( 'yes' === data.get( 'quiz_enabled' ) ) ? data.get( 'quiz' ).get( 'title' ) : '' }}}" ),
Severity: Minor
Found in includes/admin/views/builder/lesson.php and 1 other location - About 40 mins to fix
includes/admin/views/builder/lesson.php on lines 94..101

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

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

Consider simplifying this complex logical expression.
Open

            if ( ! $start && ! $end ) {

                $ret = true;

                // Start and end.
Severity: Major
Found in includes/models/model.llms.access.plan.php - About 40 mins to fix

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

                this.$metabox.on( 'click', 'a.llms-add-student', function( e ) {
                    e.preventDefault();
                    self.add_student( $( this ) );
                } );
    Severity: Minor
    Found in assets/js/llms-metabox-students.js and 2 other locations - About 40 mins to fix
    assets/js/llms-metabox-students.js on lines 55..58
    assets/js/llms-metabox-students.js on lines 60..63

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

    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 3 locations. Consider refactoring.
    Open

                this.$metabox.on( 'click', 'a.llms-remove-student', function( e ) {
                    e.preventDefault();
                    self.remove_student( $( this ) );
                } );
    Severity: Minor
    Found in assets/js/llms-metabox-students.js and 2 other locations - About 40 mins to fix
    assets/js/llms-metabox-students.js on lines 60..63
    assets/js/llms-metabox-students.js on lines 65..68

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

    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 3 locations. Consider refactoring.
    Open

                this.$metabox.on( 'click', 'a.llms-delete-enrollment', function( e ) {
                    e.preventDefault();
                    self.delete_student_enrollment( $( this ) );
                } );
    Severity: Minor
    Found in assets/js/llms-metabox-students.js and 2 other locations - About 40 mins to fix
    assets/js/llms-metabox-students.js on lines 55..58
    assets/js/llms-metabox-students.js on lines 65..68

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

    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

            if ( this.get_current_strength_status() ) {
                $pass_field.removeClass( 'invalid' ).addClass( 'valid' );
                if ( conf_length ) {
                    $conf_field.removeClass( 'invalid' ).addClass( 'valid' );
                }
    Severity: Minor
    Found in assets/js/app/llms-password-strength.js and 1 other location - About 40 mins to fix
    assets/js/app/llms-password-strength.js on lines 126..131

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

    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

            } else {
                $pass_field.removeClass( 'valid' ).addClass( 'invalid' );
                if ( conf_length ) {
                    $conf_field.removeClass( 'valid' ).addClass( 'invalid' );
                }
    Severity: Minor
    Found in assets/js/app/llms-password-strength.js and 1 other location - About 40 mins to fix
    assets/js/app/llms-password-strength.js on lines 121..126

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

    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 updateVersions has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function updateVersions( files, regex, flags, ignore, ver ) {
    Severity: Minor
    Found in packages/dev/src/cmds/update-version.js - About 35 mins to fix

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

          public function quiz_maybe_prevent_lesson_completion( $allow_completion, $user_id, $lesson_id, $trigger, $args ) {
      Severity: Minor
      Found in includes/controllers/class.llms.controller.lesson.progression.php - About 35 mins to fix

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

            public static function assign_to_course( $course_id, $section_id, $lesson_id, $duplicate = true, $reset_order = true ) {
        Severity: Minor
        Found in includes/class.llms.lesson.handler.php - About 35 mins to fix

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

              private static function register_certificate_post_type( $post_type, $labels, $args, $rewrite_slug, $admin_cap ) {
          Severity: Minor
          Found in includes/class.llms.post-types.php - About 35 mins to fix

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

                private static function can_process( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
            Severity: Minor
            Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

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

                  private static function dupcheck( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
              Severity: Minor
              Found in includes/class-llms-engagement-handler.php - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language