gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

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

    public function get_transaction_total( $type = 'amount' ) {

        // Check the cache.
        static $cache = array();
        if ( isset( $cache[ $this->get( 'id' ) ] )
Severity: Minor
Found in includes/models/model.llms.order.php - About 1 hr to fix

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

        private function get_engagements( $trigger_type, $related_post_id = '' ) {
    
            global $wpdb;
    
            $related_select = '';
    Severity: Minor
    Found in includes/class.llms.engagements.php - About 1 hr to fix

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

          protected function get_creation_args( $args = null ) {
      
              // Allow nothing to be passed in.
              if ( empty( $args ) ) {
                  $args = array();
      Severity: Minor
      Found in includes/models/model.llms.question.php - About 1 hr to fix

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

            public function pre_get_posts( $query ) {
        
                static $done      = false;
                $modify_tax_query = false;
        
        
        Severity: Minor
        Found in includes/class.llms.query.php - About 1 hr to fix

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

              public static function get_pages() {
                  /**
                   * Filters the essential starter pages.
                   *
                   * These are the pages that are going to be created when installing LifterLMS.
          Severity: Minor
          Found in includes/class.llms.install.php - About 1 hr to fix

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

                public static function register_post_statuses() {
            
                    $order_statuses = self::get_order_statuses();
            
                    $txn_statuses = apply_filters(
            Severity: Minor
            Found in includes/class.llms.post-types.php - About 1 hr to fix

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

                  public function query_quiz_questions() {
              
                      // Grab the search term if it exists.
                      $term = array_key_exists( 'term', $_REQUEST ) ? llms_filter_input_sanitize_string( INPUT_POST, 'term' ) : '';
                      $page = array_key_exists( 'page', $_REQUEST ) ? llms_filter_input( INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT ) : 0;
              Severity: Minor
              Found in includes/class.llms.ajax.php - About 1 hr to fix

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

                    private function get_fields_for_certificates() {
                
                        return array(
                            'size'        => array(
                                'description' => __( 'Certificate size.', 'lifterlms' ),
                Severity: Minor
                Found in includes/class-llms-rest-fields.php - About 1 hr to fix

                  Function process_object_updates has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function process_object_updates( data, type, parent, main_data ) {
                  
                              if ( ! data[ type ] ) {
                                  return data;
                              }
                  Severity: Minor
                  Found in assets/js/builder/Controllers/Sync.js - About 1 hr to fix

                    Method admin_footer has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function admin_footer( $text ) {
                    
                            global $current_screen;
                    
                            // Show footer on our custom post types in admin, but not on the block editor.
                    Severity: Minor
                    Found in includes/admin/class-llms-admin-review.php - About 1 hr to fix

                      Method get_sort has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function get_sort() {
                      
                              $sort = array();
                              switch ( $this->get_orderby() ) {
                      
                      
                      Severity: Minor
                      Found in includes/admin/reporting/tables/llms.table.students.php - About 1 hr to fix

                        Method get_data has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function get_data( $key, $student ) {
                        
                                $value = '';
                        
                                switch ( $key ) {
                        Severity: Minor
                        Found in includes/admin/reporting/tables/llms.table.membership.students.php - About 1 hr to fix

                          Method scrub_field has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function scrub_field( $val, $type ) {
                          
                                  if ( is_string( $val ) && 'html' !== $type ) {
                                      $val = wp_strip_all_tags( $val );
                                  }
                          Severity: Minor
                          Found in includes/abstracts/abstract.llms.post.model.php - About 1 hr to fix

                            Method toArray has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function toArray() {
                            
                                    $arr = array(
                                        'id' => $this->get( 'id' ),
                                    );
                            Severity: Minor
                            Found in includes/abstracts/abstract.llms.post.model.php - About 1 hr to fix

                              Method lifterlms_course_continue_button has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function lifterlms_course_continue_button( $post_id = null, $student = null, $progress = null ) {
                              
                                      if ( ! $post_id ) {
                                          $post_id = get_the_ID();
                                          if ( ! $post_id ) {
                              Severity: Minor
                              Found in includes/llms.template.functions.php - About 1 hr to fix

                                Method get_progress has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function get_progress( $object_id, $type = 'course', $use_cache = true ) {
                                
                                        $ret       = 0;
                                        $cache_key = sprintf( '%1$s_%2$d_progress', $type, $object_id );
                                        $cached    = $use_cache ? $this->get( $cache_key ) : '';
                                Severity: Minor
                                Found in includes/models/model.llms.student.php - About 1 hr to fix

                                  Method get_privacy_message has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function get_privacy_message() {
                                          $content = '
                                              <div class="wp-suggested-text">' .
                                                  '<p class="privacy-policy-tutorial">' .
                                                      __( 'This sample language includes the basics around what personal data your learning platform may be collecting, storing and sharing, as well as who may have access to that data. Depending on what settings are enabled and which additional add-ons are used, the specific information shared by your site will vary. We recommend consulting with a lawyer when deciding what information to disclose on your privacy policy.', 'lifterlms' ) .
                                  Severity: Minor
                                  Found in includes/privacy/class-llms-privacy.php - About 1 hr to fix

                                    Method register_fields_for_certificate_templates has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private function register_fields_for_certificate_templates() {
                                    
                                            register_rest_field(
                                                'llms_certificate',
                                                'certificate_title',
                                    Severity: Minor
                                    Found in includes/class-llms-rest-fields.php - About 1 hr to fix

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

                                                  var modelBeingSorted     = this.collection.get( ui.item.attr( 'data-model-cid' ) ),
                                                      modelViewContainerEl = this._getContainerEl(),
                                                      newIndex             = modelViewContainerEl.children().index( ui.item );
                                      Severity: Major
                                      Found in assets/js/builder/Views/LessonList.js and 1 other location - About 1 hr to fix
                                      assets/js/builder/Views/QuestionList.js on lines 136..138

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

                                      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

                                                  var modelBeingSorted = this.collection.get( ui.item.attr( 'data-model-cid' ) ),
                                                      modelViewContainerEl = this._getContainerEl(),
                                                      newIndex = modelViewContainerEl.children().index( ui.item );
                                      Severity: Major
                                      Found in assets/js/builder/Views/QuestionList.js and 1 other location - About 1 hr to fix
                                      assets/js/builder/Views/LessonList.js on lines 63..65

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

                                      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