gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

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

                        options={ [
                            { value: 'id', label: __( 'ID', 'lifterlms' ) },
                            { value: 'author', label: __( 'Author', 'lifterlms' ) },
                            { value: 'title', label: __( 'Title', 'lifterlms' ) },
                            { value: 'name', label: __( 'Name', 'lifterlms' ) },
Severity: Major
Found in src/blocks/memberships/index.jsx and 1 other location - About 5 hrs to fix
src/blocks/courses/index.jsx on lines 168..192

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

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

                        options={ [
                            { value: 'id', label: __( 'ID', 'lifterlms' ) },
                            {
                                value: 'author',
                                label: __( 'Author', 'lifterlms' ),
Severity: Major
Found in src/blocks/courses/index.jsx and 1 other location - About 5 hrs to fix
src/blocks/memberships/index.jsx on lines 107..116

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

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

            this.post_search_popover = new Popover( {
                el: '#llms-existing-quiz',
                args: {
                    backdrop: true,
                    closeable: true,
Severity: Major
Found in assets/js/builder/Views/Quiz.js and 1 other location - About 5 hrs to fix
assets/js/builder/Views/Assignment.js on lines 242..260

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

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

                    this.post_search_popover = new Popover( {
                        el: '#llms-existing-assignment',
                        args: {
                            backdrop: true,
                            closeable: true,
Severity: Major
Found in assets/js/builder/Views/Assignment.js and 1 other location - About 5 hrs to fix
assets/js/builder/Views/Quiz.js on lines 317..335

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

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

    public static function query_students() {

        _deprecated_function( __METHOD__, '6.2.0', 'the REST API list students endpoint' );

        // Grab the search term if it exists.
Severity: Minor
Found in includes/class.llms.ajax.handler.php - About 5 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 llms_update_3160_ensure_no_dupe_question_rels has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

function llms_update_3160_ensure_no_dupe_question_rels() {

    if ( 'complete' !== get_transient( 'llms_update_3160_attempt_migration' ) ) {
        return true;
    }
Severity: Minor
Found in includes/functions/updates/llms-functions-updates-3160.php - About 5 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

Method set_columns has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function set_columns() {
        return array(
            'id'                    => array(
                'exportable' => true,
                'sortable'   => true,
Severity: Major
Found in includes/admin/reporting/tables/llms.table.students.php - About 5 hrs to fix

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

        protected function get_text( $text_type, $variables = array() ) {
    
            switch ( $text_type ) {
                case self::TEXT_SYNC_AWARDED_ENGAGEMENT_INSUFFICIENT_PERMISSIONS:
                    return sprintf(
    Severity: Major
    Found in includes/controllers/class.llms.controller.certificates.php and 1 other location - About 5 hrs to fix
    includes/controllers/class.llms.controller.achievements.php on lines 53..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 187.

    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

        protected function get_text( $text_type, $variables = array() ) {
    
            switch ( $text_type ) {
                case self::TEXT_SYNC_AWARDED_ENGAGEMENT_INSUFFICIENT_PERMISSIONS:
                    return sprintf(
    Severity: Major
    Found in includes/controllers/class.llms.controller.achievements.php and 1 other location - About 5 hrs to fix
    includes/controllers/class.llms.controller.certificates.php on lines 62..88

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

    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

        const memoizedServerSideRender = useMemo( () => {
            return <ServerSideRender
                block={ blockJson.name }
                attributes={ attributes }
                LoadingResponsePlaceholder={ () =>
    Severity: Major
    Found in src/blocks/courses/index.jsx and 1 other location - About 5 hrs to fix
    src/blocks/checkout/index.jsx on lines 36..54

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

    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

        const memoizedServerSideRender = useMemo( () => {
            return <ServerSideRender
                block={ blockJson.name }
                attributes={ attributes }
                LoadingResponsePlaceholder={ () =>
    Severity: Major
    Found in src/blocks/checkout/index.jsx and 1 other location - About 5 hrs to fix
    src/blocks/courses/index.jsx on lines 56..74

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

    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

    File class.llms.meta.box.course.options.php has 375 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Course Options meta box
     *
     * @package LifterLMS/Admin/PostTypes/MetaBoxes/Classes

      LLMS_Abstract_Notification_View has 38 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class LLMS_Abstract_Notification_View extends LLMS_Abstract_Options_Data {
      
          /**
           * Settings for basic notifications
           *
      Severity: Minor
      Found in includes/abstracts/llms.abstract.notification.view.php - About 5 hrs to fix

        LLMS_Forms has 38 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class LLMS_Forms {
        
            use LLMS_Trait_Singleton;
        
            /**
        Severity: Minor
        Found in includes/forms/class-llms-forms.php - About 5 hrs to fix

          File model.llms.lesson.php has 374 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * LifterLMS Lesson Model
           *
           * @package LifterLMS/Models/Classes
          Severity: Minor
          Found in includes/models/model.llms.lesson.php - About 5 hrs to fix

            Function get_data has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                public function get_data( $key, $student ) {
            
                    $value = '';
            
                    switch ( $key ) {

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

            function llms_page_restricted( $post_id, $user_id = null ) {
            
                $results = array(
                    'content_id'     => $post_id,
                    'is_restricted'  => false,
            Severity: Minor
            Found in includes/functions/llms.functions.access.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

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

                $( '.llms_certificate_clear_image_button' ).click(function(e) {
                    e.preventDefault();
                    var certificate_remove_input_id = 'input#' + this.id + '.upload_certificate_image';
                    var certificate_img_src         = 'img#' + this.id + '.llms_certificate_image';
                    var certificate_default_img_src = $( 'img#' + this.id + '.llms_certificate_default_image' ).attr( "src" );
            Severity: Major
            Found in assets/js/llms-metabox-certificate.js and 1 other location - About 4 hrs to fix
            assets/js/llms-metabox-achievement.js on lines 46..54

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

            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_achievement_clear_image_button' ).click(function(e) {
                    e.preventDefault();
                    var achievement_remove_input_id = 'input#' + this.id + '.upload_achievement_image';
                    var achievement_img_src         = 'img#' + this.id + '.llms_achievement_image';
                    var achievement_default_img_src = $( 'img#' + this.id + '.llms_achievement_default_image' ).attr( "src" );
            Severity: Major
            Found in assets/js/llms-metabox-achievement.js and 1 other location - About 4 hrs to fix
            assets/js/llms-metabox-certificate.js on lines 51..59

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

            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

                const memoizedServerSideRender = useMemo( () => {
                    return <ServerSideRender
                        block={ blockJson.name }
                        attributes={ attributes }
                        LoadingResponsePlaceholder={ () =>
            Severity: Major
            Found in src/blocks/course-outline/index.jsx and 5 other locations - About 4 hrs to fix
            src/blocks/login/index.jsx on lines 19..33
            src/blocks/memberships/index.jsx on lines 43..57
            src/blocks/my-account/index.jsx on lines 22..36
            src/blocks/my-achievements/index.jsx on lines 35..49
            src/blocks/registration/index.jsx on lines 16..30

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

            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

            Severity
            Category
            Status
            Source
            Language