gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Method heartbeat_received has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function heartbeat_received( $res, $data ) {

        // Exit if there's no builder data in the heartbeat data.
        if ( empty( $data['llms_builder'] ) ) {
            return $res;
Severity: Minor
Found in includes/admin/class.llms.admin.builder.php - About 1 hr to fix

    Method sideload_images has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function sideload_images( $post, $raw ) {
    
            // Sideloading is disabled.
            if ( ! $this->is_image_sideloading_enabled() ) {
                return null;
    Severity: Minor
    Found in includes/abstracts/llms-abstract-generator-posts.php - About 1 hr to fix

      Method get_order_data_props has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected static function get_order_data_props( $type ) {
      
              $props = array();
      
              // don't erase these fields, only export them
      Severity: Minor
      Found in includes/privacy/class-llms-privacy.php - About 1 hr to fix

        Method validate_field has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function validate_field( $posted_value, $field ) {
        
                // Validate field by type.
                $type_map = array(
                    'email'  => array( $this, 'validate_field_email' ),
        Severity: Minor
        Found in includes/forms/class-llms-form-validator.php - About 1 hr to fix

          Method create_question has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function create_question( $raw, $manager, $author_id ) {
          
                  /**
                   * Filter raw question import data prior to generation
                   *
          Severity: Minor
          Found in includes/class-llms-generator-courses.php - About 1 hr to fix

            Method handle_caps has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function handle_caps( $allcaps, $cap, $args ) {
            
                    /**
                     * Modify the list of post types that users may not own but can still edit based on instructor permissions on the course
                     *
            Severity: Minor
            Found in includes/class.llms.user.permissions.php - About 1 hr to fix

              Method prepare_meta_query_for_relationships has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function prepare_meta_query_for_relationships() {
              
                      $meta_query = array();
              
                      $relations = array(
              Severity: Minor
              Found in includes/class-llms-awards-query.php - About 1 hr to fix

                Method render_block has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function render_block( array $attributes, string $content, WP_Block $block ): string {
                        if ( ! property_exists( $block, 'name' ) ) {
                            return '';
                        }
                
                
                Severity: Minor
                Found in includes/shortcodes/class.llms.shortcodes.blocks.php - About 1 hr to fix

                  Method handle_prerequisites has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function handle_prerequisites() {
                  
                          foreach ( array( 'course', 'lesson' ) as $obj_type ) {
                  
                              $ids = ! empty( $this->tempids[ $obj_type ] ) ? $this->tempids[ $obj_type ] : array();
                  Severity: Minor
                  Found in includes/class-llms-generator-courses.php - About 1 hr to fix

                    Method set_body_email has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function set_body_email() {
                    
                            $mailer = llms()->mailer();
                    
                            $rows = array(

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

                              on_trashed: function( quiz ) {
                      
                                  this.lesson.set( 'quiz_enabled', 'no' );
                                  this.lesson.set( 'quiz', '' );
                      
                      
                      Severity: Major
                      Found in assets/js/builder/Views/Quiz.js and 1 other location - About 1 hr to fix
                      assets/js/builder/Views/Assignment.js on lines 294..303

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

                      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

                                  on_trashed: function( assignment ) {
                      
                                      this.lesson.set( 'assignment_enabled', 'no' );
                                      this.lesson.set( 'assignment', '' );
                      
                      
                      Severity: Major
                      Found in assets/js/builder/Views/Assignment.js and 1 other location - About 1 hr to fix
                      assets/js/builder/Views/Quiz.js on lines 365..374

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

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

                              bind: function() {
                      
                                  var self = this;
                      
                                  // start quiz
                      Severity: Minor
                      Found in assets/js/llms-quiz.js - About 1 hr to fix

                        Function delete_plan has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                this.delete_plan = function( $btn ) {
                        
                                    var self    = this,
                                        $plan   = $btn.closest( '.llms-access-plan' ),
                                        plan_id = $plan.attr( 'data-id' ),
                        Severity: Minor
                        Found in assets/js/llms-metabox-product.js - About 1 hr to fix

                          Function draggable has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  draggable: function() {
                          
                                      $( '#llms-new-section' ).draggable( {
                                          appendTo: '#llms-sections',
                                          cancel: false,
                          Severity: Minor
                          Found in assets/js/builder/Views/Elements.js - About 1 hr to fix

                            Function load_questions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    load_questions: function( cb ) {
                            
                                        if ( this.get( '_questions_loaded' ) ) {
                            
                                            cb();
                            Severity: Minor
                            Found in assets/js/builder/Models/Quiz.js - About 1 hr to fix

                              Function favorite has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      favorite: function( $btn ) {
                              
                                          var object_id     = $btn.attr( 'data-id' ),
                                              object_type = $btn.attr( 'data-type' ),
                                              user_action    = $btn.attr( 'data-action' );
                              Severity: Minor
                              Found in assets/js/llms-favorites.js - About 1 hr to fix

                                Function success has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                                success: function( res ) {
                                
                                                    if ( ! res.success && res.message ) {
                                
                                                        activate_button();
                                Severity: Minor
                                Found in assets/js/llms-admin-tables.js - About 1 hr to fix

                                  Method get_model has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public static function get_model() {
                                  
                                          return apply_filters(
                                              'llms_question_type_model_defaults',
                                              array(
                                  Severity: Minor
                                  Found in includes/class.llms.question.types.php - About 1 hr to fix

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

                                        public static function output( $post ) {
                                    
                                            global $post;
                                            if ( 'publish' !== $post->post_status ) {
                                                esc_html_e( 'You need to publish this post before you can generate a CSV.', 'lifterlms' );
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language