gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

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

    public static function get_current_memberships() {

        $r = isset( $_GET['membership_ids'] ) ? llms_filter_input( INPUT_GET, 'membership_ids', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY ) : array();

        if ( '' === $r ) {
Severity: Major
Found in includes/admin/reporting/class.llms.admin.reporting.php and 2 other locations - About 1 hr to fix
includes/admin/reporting/class.llms.admin.reporting.php on lines 45..56
includes/admin/reporting/class.llms.admin.reporting.php on lines 105..115

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

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

    public static function get_current_students() {

        $r = isset( $_GET['student_ids'] ) ? llms_filter_input( INPUT_GET, 'student_ids', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY ) : array();
        if ( '' === $r ) {
            $r = array();
Severity: Major
Found in includes/admin/reporting/class.llms.admin.reporting.php and 2 other locations - About 1 hr to fix
includes/admin/reporting/class.llms.admin.reporting.php on lines 45..56
includes/admin/reporting/class.llms.admin.reporting.php on lines 68..79

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

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

                $codes = array(
                    '{site_title}'    => __( 'Website Title', 'lifterlms' ),
                    '{site_url}'      => __( 'Website URL', 'lifterlms' ),
                    '{email_address}' => __( 'Student Email Address', 'lifterlms' ),
                    '{user_login}'    => __( 'Student Username', 'lifterlms' ),
Severity: Major
Found in includes/admin/llms.functions.admin.php and 1 other location - About 1 hr to fix
includes/notifications/views/class.llms.notification.view.quiz.graded.php on lines 133..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 108.

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

    public static function get_current_courses() {

        $r = isset( $_GET['course_ids'] ) ? llms_filter_input( INPUT_GET, 'course_ids', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY ) : array();

        if ( '' === $r ) {
Severity: Major
Found in includes/admin/reporting/class.llms.admin.reporting.php and 2 other locations - About 1 hr to fix
includes/admin/reporting/class.llms.admin.reporting.php on lines 68..79
includes/admin/reporting/class.llms.admin.reporting.php on lines 105..115

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

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 array(
            '{{COURSE_TITLE}}' => __( 'Course Title', 'lifterlms' ),
            '{{GRADE}}'        => __( 'Grade', 'lifterlms' ),
            '{{LESSON_TITLE}}' => __( 'Lesson Title', 'lifterlms' ),
            '{{QUIZ_TITLE}}'   => __( 'Quiz Title', 'lifterlms' ),
includes/admin/llms.functions.admin.php on lines 294..302

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

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

        is_valid: function( event ) {

            var self    = this,
                $el     = $( event.target ),
                content = this.get_content( $el ),
Severity: Minor
Found in assets/js/builder/Views/_Editable.js - About 1 hr to fix

    Function updateConfig has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function updateConfig( ver ) {
        const ret = {
            Matches: chalk.yellow( 1 ),
            Replacements: chalk.yellow( 1 ),
        };
    Severity: Minor
    Found in packages/dev/src/cmds/update-version.js - About 1 hr to fix

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

          public function output() {
      
              $order = new LLMS_Order( $this->post );
      
              $curr_page = isset( $_GET['notes-page'] ) ? absint( wp_unslash( $_GET['notes-page'] ) ) : 1;

        Method set_columns has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function set_columns() {
        
                $cols = array(
                    'id'         => array(
                        'exportable' => true,
        Severity: Minor
        Found in includes/admin/reporting/tables/llms.table.quiz.attempts.php - About 1 hr to fix

          Method get_settings has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get_settings() {
          
                  $settings = array();
          
                  $settings[] = array(
          Severity: Minor
          Found in includes/admin/settings/class.llms.settings.notifications.php - About 1 hr to fix

            Method set_user_data has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function set_user_data( $user_or_data ) {
            
                    $to_set = array(
                        'user_id'            => '',
                        'billing_email'      => '',
            Severity: Minor
            Found in includes/models/model.llms.order.php - About 1 hr to fix

              Method create_post has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function create_post( $type, $raw = array(), $author_id = null ) {
              
                      $class_name = sprintf( 'LLMS_%s', implode( '_', array_map( 'ucfirst', explode( '_', $type ) ) ) );
                      if ( ! class_exists( $class_name ) ) {
                          throw new Exception( esc_html( sprintf( __( 'The class "%s" does not exist.', 'lifterlms' ), $class_name ) ), intval( self::ERROR_INVALID_POST ) );
              Severity: Minor
              Found in includes/abstracts/llms-abstract-generator-posts.php - About 1 hr to fix

                Method dispatch_sync has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function dispatch_sync( $engagement_template_id ) {
                
                        $this->log(
                            sprintf(
                                'awarded %1$ss bulk sync dispatched for the %1$s template %2$s (#%3$d)',
                Severity: Minor
                Found in includes/abstracts/llms-abstract-processor-user-engagement-sync.php - About 1 hr to fix

                  Method switch_payment_source_setup has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function switch_payment_source_setup() {
                  
                          $order_id = llms_filter_input( INPUT_POST, 'order_id', FILTER_SANITIZE_NUMBER_INT );
                          if ( ! $order_id ) {
                              return new WP_Error( 'switch-source-order-missing', __( 'Missing order information.', 'lifterlms' ), 'error' );
                  Severity: Minor
                  Found in includes/controllers/class-llms-controller-checkout.php - About 1 hr to fix

                    Method prepare_data_for_insert has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function prepare_data_for_insert( $posted_data, $fields, $action ) {
                    
                            $prepared = array();
                    
                            foreach ( $fields as $field ) {
                    Severity: Minor
                    Found in includes/forms/class-llms-form-handler.php - About 1 hr to fix

                      Method llms_update_3160_update_attempt_question_data has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function llms_update_3160_update_attempt_question_data() {
                      
                          if ( 'complete' !== get_transient( 'llms_update_3160_update_question_data' ) ) {
                              return true;
                          }
                      Severity: Minor
                      Found in includes/functions/updates/llms-functions-updates-3160.php - About 1 hr to fix

                        Method get_output has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function get_output() {
                        
                                $course  = new LLMS_Course( $this->get_attribute( 'course_id' ) );
                                $student = llms_get_student();
                        
                        
                        Severity: Minor
                        Found in includes/shortcodes/class.llms.shortcode.course.outline.php - About 1 hr to fix

                          Method get_tax_query has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function get_tax_query() {
                          
                                  $has_tax_query = false;
                          
                                  $tax_query = array(
                          Severity: Minor
                          Found in includes/shortcodes/class.llms.shortcode.courses.php - About 1 hr to fix

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

                                        if ( 'clone' === event.action ) {
                            
                                            quiz = _.prepareQuizObjectForCloning( quiz );
                            
                                        } else {
                            Severity: Major
                            Found in assets/js/builder/Views/Quiz.js and 2 other locations - About 1 hr to fix
                            assets/js/builder/Views/Assignment.js on lines 204..214
                            assets/js/builder/Views/QuestionType.js on lines 142..148

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

                            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

                                            if ( 'clone' === event.action ) {
                            
                                                assignment = _.prepareAssignmentObjectForCloning( assignment );
                            
                                            } else {
                            Severity: Major
                            Found in assets/js/builder/Views/Assignment.js and 2 other locations - About 1 hr to fix
                            assets/js/builder/Views/QuestionType.js on lines 142..148
                            assets/js/builder/Views/Quiz.js on lines 285..295

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

                            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