gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Method maybe_run_actions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function maybe_run_actions() {

        if ( ! llms_verify_nonce( '_llms_quiz_attempt_nonce', 'llms_quiz_attempt_actions', 'POST' ) ) {
            return;
        }
Severity: Minor
Found in includes/controllers/class.llms.controller.admin.quiz.attempts.php - About 1 hr to fix

    Method enqueue_content_protection has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function enqueue_content_protection() {
    
            $allow_copying = ! llms_parse_bool( get_option( 'lifterlms_content_protection', 'no' ) ) || llms_can_user_bypass_restrictions( get_current_user_id() );
    
            /**
    Severity: Minor
    Found in includes/class.llms.frontend.assets.php - About 1 hr to fix

      Method get_quiz_attempt_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function get_quiz_attempt_data( $attempt ) {
      
              $data = array();
      
              $quiz = $attempt->get_quiz();
      Severity: Minor
      Found in includes/privacy/class-llms-privacy-exporters.php - About 1 hr to fix

        Method llms_get_terms_notice has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function llms_get_terms_notice( $merge = false ) {
        
            // Get the option.
            $text = get_option( 'llms_terms_notice' );
        
        
        Severity: Minor
        Found in includes/functions/llms.functions.privacy.php - About 1 hr to fix

          Method llms_is_post_restricted_by_time_period has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function llms_is_post_restricted_by_time_period( $post_id, $user_id = null ) {
          
              $post_type = get_post_type( $post_id );
          
              switch ( $post_type ) {
          Severity: Minor
          Found in includes/functions/llms.functions.access.php - About 1 hr to fix

            Method get_revenue has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function get_revenue( $period ) {
            
                    $query     = $this->orders_query( -1 );
                    $order_ids = wp_list_pluck( $query->posts, 'ID' );
            
            
            Severity: Minor
            Found in includes/class.llms.course.data.php - About 1 hr to fix

              Method llms_get_picture_choice_question_cols has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function llms_get_picture_choice_question_cols( $num_choices ) {
              
                  /**
                   * Allow 3rd parties to override this function with a custom number of columns.
                   *
              Severity: Minor
              Found in includes/functions/llms.functions.quiz.php - About 1 hr to fix

                Method lifterlms_template_certificates_loop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function lifterlms_template_certificates_loop( $student = null, $limit = false ) {
                
                        // Get the current student if none supplied.
                        if ( ! $student ) {
                            $student = llms_get_student();
                Severity: Minor
                Found in includes/functions/llms.functions.templates.certificates.php - About 1 hr to fix

                  Method llms_get_post_content has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function llms_get_post_content( $content ) {
                  
                          global $post;
                          if ( ! $post instanceof WP_Post ) {
                              return $content;
                  Severity: Minor
                  Found in includes/functions/llms-functions-content.php - About 1 hr to fix

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

                                            <?php if ( 'theme' !== $addon->get_type() ) : ?>
                                                <label class="llms-status-icon status--<?php echo esc_attr( $addon->get_status() ); ?>" for="<?php echo esc_attr( sprintf( '%s-deactivate', $addon->get( 'id' ) ) ); ?>">
                                                    <input class="llms-bulk-check" data-action="deactivate" name="llms_deactivate[]" id="<?php echo esc_attr( sprintf( '%s-deactivate', $addon->get( 'id' ) ) ); ?>" type="checkbox" value="<?php echo esc_attr( $addon->get( 'id' ) ); ?>">
                                                    <i class="fa fa-check-square-o" aria-hidden="true"></i>
                                                    <i class="fa fa-plug" aria-hidden="true"></i>
                    Severity: Major
                    Found in includes/admin/views/addons/addon-item.php and 1 other location - About 1 hr to fix
                    includes/admin/views/addons/addon-item.php on lines 99..106

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

                    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 else : ?>
                                            <label class="llms-status-icon status--<?php echo esc_attr( $addon->get_status() ); ?>" for="<?php echo esc_attr( sprintf( '%s-activate', $addon->get( 'id' ) ) ); ?>">
                                                <input class="llms-bulk-check" data-action="activate" name="llms_activate[]" id="<?php echo esc_attr( sprintf( '%s-activate', $addon->get( 'id' ) ) ); ?>" type="checkbox" value="<?php echo esc_attr( $addon->get( 'id' ) ); ?>">
                                                <i class="fa fa-check-square-o" aria-hidden="true"></i>
                                                <i class="fa fa-plug" aria-hidden="true"></i>
                    Severity: Major
                    Found in includes/admin/views/addons/addon-item.php and 1 other location - About 1 hr to fix
                    includes/admin/views/addons/addon-item.php on lines 91..98

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

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

                            getCountdown: function( total_minutes, target_date, time_limit, days, hours, minutes, seconds, countdown ){
                    Severity: Major
                    Found in assets/js/llms-quiz.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if ( is_llms_account_page() || is_course() || is_membership() || is_lesson() || is_memberships() || is_courses() || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {
                                  llms()->assets->enqueue_script( 'llms-jquery-matchheight' );
                              }
                      Severity: Major
                      Found in includes/class.llms.frontend.assets.php - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if ( ( ! empty( $field['attributes']['min'] ) || ( isset( $field['attributes']['min'] ) && '0' === $field['attributes']['min'] ) ) && $temp_value < $field['attributes']['min'] ) {
                                        // Translators: %1$s = field label or name; %2$s = user submitted value; %3$d = minimum allowed number.
                                        return new WP_Error( 'llms-form-field-invalid', sprintf( __( 'The %1$s "%2$s" must be greater than or equal to %3$d.', 'lifterlms' ), isset( $field['label'] ) ? $field['label'] : $field['name'], $posted_value, $field['attributes']['min'] ) );
                                    } elseif ( ( ! empty( $field['attributes']['max'] ) || ( isset( $field['attributes']['max'] ) && '0' === $field['attributes']['max'] ) ) && $temp_value > $field['attributes']['max'] ) {
                                        // Translators: %1$s = field label or name; %2$s = user submitted value; %3$d = maximum allowed number.
                        Severity: Major
                        Found in includes/forms/class-llms-form-validator.php - About 1 hr to fix

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

                                  return apply_filters(
                                      "llms_{$this->model_post_type}_get_creation_args",
                                      array(
                                          'comment_status' => 'closed',
                                          'ping_status'    => 'closed',
                          Severity: Minor
                          Found in includes/models/model.llms.transaction.php and 1 other location - About 1 hr to fix
                          includes/models/model.llms.order.php on lines 739..754

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

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  return apply_filters(
                                      "llms_{$this->model_post_type}_get_creation_args",
                                      array(
                                          'comment_status' => 'closed',
                                          'ping_status'    => 'closed',
                          Severity: Minor
                          Found in includes/models/model.llms.order.php and 1 other location - About 1 hr to fix
                          includes/models/model.llms.transaction.php on lines 193..208

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

                          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

                                      if( this._isBackboneCourierAvailable() ) {
                                          this.spawn( 'sortStop', { modelBeingSorted : modelBeingSorted, newIndex : newIndex } );
                                      } else {
                                          this.trigger( 'sortStop', modelBeingSorted, newIndex );
                                      }
                          Severity: Minor
                          Found in assets/js/builder/Views/QuestionList.js and 1 other location - About 55 mins to fix
                          assets/js/builder/Views/LessonList.js on lines 74..78

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

                          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

                                      if ( this._isBackboneCourierAvailable() ) {
                                          this.spawn( 'sortStop', { modelBeingSorted : modelBeingSorted, newIndex : newIndex } );
                                      } else {
                                          this.trigger( 'sortStop', modelBeingSorted, newIndex );
                                      }
                          Severity: Minor
                          Found in assets/js/builder/Views/LessonList.js and 1 other location - About 55 mins to fix
                          assets/js/builder/Views/QuestionList.js on lines 147..151

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

                          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.wait_for_matchHeight = function( cb ) {
                                  this.wait_for( function() {
                                      return ( undefined !== $.fn.matchHeight );
                                  }, cb, 'matchHeight' );
                              }
                          Severity: Minor
                          Found in assets/js/private/llms.js and 1 other location - About 55 mins to fix
                          assets/js/private/llms.js on lines 102..106

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

                          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.wait_for_popover = function( cb ) {
                                  this.wait_for( function() {
                                      return ( undefined !== $.fn.webuiPopover );
                                  }, cb, 'webuiPopover' );
                              }
                          Severity: Minor
                          Found in assets/js/private/llms.js and 1 other location - About 55 mins to fix
                          assets/js/private/llms.js on lines 87..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 54.

                          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