gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Method output has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function output() {

        if ( is_wp_error( $this->get_data() ) ) {
            esc_html_e( 'There was an error retrieving add-ons. Please try again.', 'lifterlms' );
            return;
Severity: Minor
Found in includes/admin/class.llms.admin.addons.php - About 1 hr to fix

    Method ___get has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function ___get( $key, $raw = false ) {
    
            // Force numeric id and prevent filtering on the id.
            if ( 'id' === $key ) {
    
    
    Severity: Minor
    Found in includes/abstracts/abstract.llms.post.model.php - About 1 hr to fix

      Method parse_properties_to_set has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function parse_properties_to_set( $model_array ) {
      
              $llms_post = array(
                  'post' => array(),
                  'meta' => array(),
      Severity: Minor
      Found in includes/abstracts/abstract.llms.post.model.php - About 1 hr to fix

        Method quiz_start has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function quiz_start( $request ) {
        
                $err = new WP_Error();
        
                $student = llms_get_student();
        Severity: Minor
        Found in includes/class.llms.ajax.handler.php - About 1 hr to fix

          Method remove_membership_level has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function remove_membership_level( $membership_id, $status = 'expired', $delete = false ) {
          
                  // Remove the user from the membership level.
                  $membership_levels = $this->get_membership_levels();
                  $key               = array_search( $membership_id, $membership_levels );
          Severity: Minor
          Found in includes/models/model.llms.student.php - About 1 hr to fix

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

                            array(
                                'default' => 'menu_order',
                                'desc'    => __( 'Determines the display order for courses on the courses page.', 'lifterlms' ),
                                'id'      => 'lifterlms_shop_ordering',
                                'options' => array(
            Severity: Major
            Found in includes/admin/settings/class.llms.settings.courses.php and 1 other location - About 1 hr to fix
            includes/admin/settings/class.llms.settings.memberships.php on lines 121..134

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

            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

                                    echo paginate_links(
                                        array(
                                            'base'      => str_replace( 999999, '%#%', esc_url( get_pagenum_link( 999999 ) ) ),
                                            'format'    => '?page=%#%',
                                            'total'     => $pagination['max'],
            Severity: Major
            Found in templates/myaccount/my-grades.php and 1 other location - About 1 hr to fix
            templates/myaccount/my-notifications.php on lines 31..42

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

            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

                        $pagination = paginate_links(
                            array(
                                'base'      => str_replace( 999999, '%#%', esc_url( get_pagenum_link( 999999 ) ) ),
                                'format'    => '?page=%#%',
                                'total'     => $pagination['max'],
            Severity: Major
            Found in templates/myaccount/my-notifications.php and 1 other location - About 1 hr to fix
            templates/myaccount/my-grades.php on lines 48..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 115.

            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(
                                'default' => 'menu_order',
                                'desc'    => __( 'Determines the display order for items on the memberships page.', 'lifterlms' ),
                                'id'      => 'lifterlms_memberships_ordering',
                                'options' => array(
            Severity: Major
            Found in includes/admin/settings/class.llms.settings.memberships.php and 1 other location - About 1 hr to fix
            includes/admin/settings/class.llms.settings.courses.php on lines 128..141

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

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

                var Grading = function() {
            
                    /**
                     * Bind DOM events
                     *
            Severity: Minor
            Found in assets/js/llms-quiz-attempt-review.js - About 1 hr to fix

              Function controller_change has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      this.controller_change = function( $el ) {
              
                          var id        = $el.attr( 'data-controller-id' ),
                              val       = $el.val(),
                              $form     = $el.closest( '.llms-access-plan' ),
              Severity: Minor
              Found in assets/js/llms-metabox-product.js - About 1 hr to fix

                Method is_authorized_to_view has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function is_authorized_to_view( $user_id, $media_id ): ?bool {
                        if ( ! is_numeric( $media_id ) || ! intval( $media_id ) ) {
                            return null;
                        }
                
                
                Severity: Minor
                Found in includes/class-llms-media-protector.php - About 1 hr to fix

                  Method output has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function output() {
                  
                          global $post;
                  
                          if ( isset( $this->field['meta'] ) ) {

                    Method get_notification_settings has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function get_notification_settings( $controller ) {
                    
                            $settings = array();
                    
                            // Setup vars.
                    Severity: Minor
                    Found in includes/admin/settings/class.llms.settings.notifications.php - About 1 hr to fix

                      Method llms_update_450_migrate_events_open_sessions has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function llms_update_450_migrate_events_open_sessions() {
                      
                          $limit = 200;
                          $skip  = get_transient( 'llms_450_skipper_events_open_sessions' );
                          if ( ! $skip ) {
                      Severity: Minor
                      Found in includes/functions/updates/llms-functions-updates-450.php - About 1 hr to fix

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

                        <?php
                        /**
                         * Meta box Field: Button
                         *
                         * @package LifterLMS/Admin/PostTypes/MetaBoxes/Fields/Classes
                        includes/admin/post-types/meta-boxes/fields/llms.class.meta.box.search.php on lines 1..51

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

                        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

                        <?php
                        /**
                         * Meta box Field: Search
                         *
                         * @package LifterLMS/Admin/PostTypes/MetaBoxes/Fields/Classes
                        includes/admin/post-types/meta-boxes/fields/llms.class.meta.box.button.php on lines 1..51

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

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

                            bind: function() {
                        
                                var self = this;
                        
                                this.$outlines.each( function() {
                        Severity: Minor
                        Found in assets/js/app/llms-outline-collapse.js - About 1 hr to fix

                          Method save has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function save( $post_id ) {
                          
                                  if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) {
                                      return;
                                  }
                          Severity: Minor
                          Found in includes/admin/post-types/meta-boxes/class.llms.meta.box.coupon.php - About 1 hr to fix

                            Method get_basic_html has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function get_basic_html() {
                            
                                    // Setup html classes.
                                    $classes = array(
                                        'llms-notification',
                            Severity: Minor
                            Found in includes/abstracts/llms.abstract.notification.view.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language