gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

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

                array(
                    'sales'    => array(
                        'title'   => __( '# of Sales', 'lifterlms' ),
                        'cols'    => '1-4',
                        'content' => __( 'loading...', 'lifterlms' ),
includes/admin/reporting/tabs/class.llms.admin.reporting.tab.enrollments.php on lines 67..92

Duplicated Code

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

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

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

Tuning

This issue has a mass of 228.

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(
                    'registrations'     => array(
                        'title'   => __( 'Registrations', 'lifterlms' ),
                        'cols'    => '1-4',
                        'content' => __( 'loading...', 'lifterlms' ),
includes/admin/reporting/tabs/class.llms.admin.reporting.tab.sales.php on lines 66..91

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

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-form-field.php has 461 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Setup and render form fields.
 *
 * @package LifterLMS/Classes
Severity: Minor
Found in includes/forms/class-llms-form-field.php - About 7 hrs to fix

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

        public function output() {
    
            // Single membership.
            if ( isset( $_GET['membership_id'] ) ) {
    
    
    includes/admin/reporting/tabs/class.llms.admin.reporting.tab.courses.php on lines 94..130

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

    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

        public function output() {
    
            // Single course.
            if ( isset( $_GET['course_id'] ) ) {
    
    
    includes/admin/reporting/tabs/class.llms.admin.reporting.tab.memberships.php on lines 69..103

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

    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 ( ! function_exists( 'lifterlms_template_student_dashboard_my_achievements' ) ) {
    
        /**
         * Template for My Achievements on dashboard
         *
    Severity: Major
    Found in includes/functions/llms.functions.templates.dashboard.php and 1 other location - About 6 hrs to fix
    includes/functions/llms.functions.templates.dashboard.php on lines 509..559

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

    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 ( ! function_exists( 'lifterlms_template_student_dashboard_my_certificates' ) ) {
    
        /**
         * Template for My Certificates on dashboard
         *
    Severity: Major
    Found in includes/functions/llms.functions.templates.dashboard.php and 1 other location - About 6 hrs to fix
    includes/functions/llms.functions.templates.dashboard.php on lines 457..507

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

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

        var AdminTables = function() {
    
            this.$tables = null;
    
            /**
    Severity: Major
    Found in assets/js/llms-admin-tables.js - About 6 hrs to fix

      File llms.table.students.php has 455 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Students Reporting Table
       *
       * @package LifterLMS/Admin/Reporting/Tables/Classes
      Severity: Minor
      Found in includes/admin/reporting/tables/llms.table.students.php - About 6 hrs to fix

        Method get_fields has 172 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function get_fields() {
        
                $courses     = array();
                $memberships = array();
        
        
        Severity: Major
        Found in includes/admin/post-types/meta-boxes/class.llms.meta.box.coupon.php - About 6 hrs to fix

          LLMS_Student has 49 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class LLMS_Student extends LLMS_Abstract_User_Data {
          
              use LLMS_Trait_Student_Awards;
          
              /**
          Severity: Minor
          Found in includes/models/model.llms.student.php - About 6 hrs to fix

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

                            'labels'              => array(
                                'name'               => __( 'Reviews', 'lifterlms' ),
                                'singular_name'      => __( 'Review', 'lifterlms' ),
                                'menu_name'          => _x( 'Reviews', 'Admin menu name', 'lifterlms' ),
                                'add_new'            => __( 'Add Review', 'lifterlms' ),
            Severity: Major
            Found in includes/class.llms.post-types.php and 2 other locations - About 6 hrs to fix
            includes/class.llms.post-types.php on lines 456..471
            includes/class.llms.post-types.php on lines 645..660

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

            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

                            'labels'              => array(
                                'name'               => __( 'Courses', 'lifterlms' ),
                                'singular_name'      => __( 'Course', 'lifterlms' ),
                                'menu_name'          => _x( 'Courses', 'Admin menu name', 'lifterlms' ),
                                'add_new'            => __( 'Add Course', 'lifterlms' ),
            Severity: Major
            Found in includes/class.llms.post-types.php and 2 other locations - About 6 hrs to fix
            includes/class.llms.post-types.php on lines 645..660
            includes/class.llms.post-types.php on lines 1060..1075

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

            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

                            'labels'              => array(
                                'name'               => __( 'Memberships', 'lifterlms' ),
                                'singular_name'      => __( 'Membership', 'lifterlms' ),
                                'menu_name'          => _x( 'Memberships', 'Admin menu name', 'lifterlms' ),
                                'add_new'            => __( 'Add Membership', 'lifterlms' ),
            Severity: Major
            Found in includes/class.llms.post-types.php and 2 other locations - About 6 hrs to fix
            includes/class.llms.post-types.php on lines 456..471
            includes/class.llms.post-types.php on lines 1060..1075

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

            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

            Method settings has 166 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function settings() {
                    ?>
                    <p><?php _e( 'LifterLMS uses custom post types and taxonomies to organize your courses and memberships. You can customize the URLs for these items here.', 'lifterlms' ); ?></p>
            
                    <?php
            Severity: Major
            Found in includes/admin/class-llms-admin-permalinks.php - About 6 hrs to fix

              File class-llms-forms.php has 440 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Register and manage LifterLMS user forms.
               *
               * @package LifterLMS/Classes
              Severity: Minor
              Found in includes/forms/class-llms-forms.php - About 6 hrs to fix

                Method get_fields has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get_fields() {
                
                        global $post;
                
                        $membership = new LLMS_Membership( $this->post );

                  Method get_types has 160 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function get_types() {
                  
                          $upgrade_url = 'https://lifterlms.com/product/advanced-quizzes/?utm_source=LifterLMS%20Plugin&utm_medium=Quiz%20Builder%20Button&utm_campaign=Advanced%20Question%20Upsell&utm_content=3.16.0&utm_term=';
                  
                          return array(
                  Severity: Major
                  Found in includes/class.llms.question.types.php - About 6 hrs to fix

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

                        public function get_results( $args = array() ) {
                    
                            $args = $this->clean_args( $args );
                    
                            if ( is_numeric( $args['student'] ) ) {
                    Severity: Major
                    Found in includes/admin/reporting/tables/llms.table.achievements.php and 1 other location - About 6 hrs to fix
                    includes/admin/reporting/tables/llms.table.certificates.php on lines 175..209

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

                    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

                        public function get_results( $args = array() ) {
                    
                            $args = $this->clean_args( $args );
                    
                            if ( is_numeric( $args['student'] ) ) {
                    Severity: Major
                    Found in includes/admin/reporting/tables/llms.table.certificates.php and 1 other location - About 6 hrs to fix
                    includes/admin/reporting/tables/llms.table.achievements.php on lines 171..205

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

                    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