gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

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

    'checkout'     => array(
        'name'        => __( 'Checkout', 'lifterlms' ),
        'description' => __( 'Handles new user registration and existing user information updates during checkout and enrollment.', 'lifterlms' ),
        'title'       => __( 'Billing Information', 'lifterlms' ),
        'template'    => LLMS_Form_Templates::get_template( 'checkout' ),
Severity: Major
Found in includes/schemas/llms-form-locations.php and 1 other location - About 1 hr to fix
includes/schemas/llms-form-locations.php on lines 41..61

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

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

    'registration' => array(
        'name'        => __( 'Registration', 'lifterlms' ),
        'description' => __( 'Handles new user registration and existing user information updates for open registration on the student dashboard and wherever the [lifterlms_registration] shortcode is used.', 'lifterlms' ),
        'title'       => __( 'Register', 'lifterlms' ),
        'template'    => LLMS_Form_Templates::get_template( 'registration' ),
Severity: Major
Found in includes/schemas/llms-form-locations.php and 1 other location - About 1 hr to fix
includes/schemas/llms-form-locations.php on lines 20..40

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

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

        views: {
            elements: {
                class: Elements,
                instance: null,
                state: 'builder',
Severity: Major
Found in assets/js/builder/Views/Sidebar.js and 1 other location - About 1 hr to fix
assets/js/builder/Views/Editor.js on lines 33..49

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

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

            views: {
                lesson: {
                    class: LessonEditor,
                    instance: null,
                    state: 'lesson',
Severity: Major
Found in assets/js/builder/Views/Editor.js and 1 other location - About 1 hr to fix
assets/js/builder/Views/Sidebar.js on lines 31..47

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

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

        render: function() {

            this.$el.html( this.template( this.model ) );

            // Render the quiz builder.
Severity: Minor
Found in assets/js/builder/Views/Quiz.js - About 1 hr to fix

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

        public function set_columns() {
            $cols = array(
                'id'          => array(
                    'sortable' => true,
                    'title'    => __( 'ID', 'lifterlms' ),

      Method block_editor_assets_for_certificates has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function block_editor_assets_for_certificates() {
      
              llms()->assets->enqueue_script( 'llms-admin-certificate-editor' );
      
              $settings = array(
      Severity: Minor
      Found in includes/admin/class.llms.admin.assets.php - About 1 hr to fix

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

            public function get_data( $key, $certificate ) {
        
                // Handle old object being passed in.
                if ( ! is_a( $certificate, 'LLMS_User_Certificate' ) && property_exists( $certificate, 'certificate_id' ) ) {
                    $certificate = llms_get_certificate( $certificate->certificate_id );
        Severity: Minor
        Found in includes/admin/reporting/tables/llms.table.certificates.php - About 1 hr to fix

          Function Donut has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          LLMS.Donut = function( $el ) {
          
              /**
               * Constructor
               *
          Severity: Minor
          Found in assets/js/app/llms-donut.js - About 1 hr to fix

            Function getChangelogValidationIssues has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getChangelogValidationIssues( logEntry, formatting = true ) {
                const options = getChangelogOptions(),
                    errors = [],
                    warnings = [];
            
            
            Severity: Minor
            Found in packages/dev/src/utils/validate-changelog.js - About 1 hr to fix

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

                  public function save( $post_id ) {
              
                      if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) {
                          return -1;
                      }

                Method get_widget_data has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get_widget_data() {
                        return apply_filters(
                            'llms_reporting_tab_sales_widgets',
                            array(
                                array(

                  Method schedule_sync has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function schedule_sync( $engagement_template_id ) {
                  
                          $this->log(
                              sprintf(
                                  'awarded %1$ss bulk sync 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 quiz_answer_question has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function quiz_answer_question( $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 get_completed_courses has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function get_completed_courses( $args = array() ) {
                      
                              global $wpdb;
                      
                              $args = array_merge(
                      Severity: Minor
                      Found in includes/models/model.llms.student.php - About 1 hr to fix

                        Method sql_where has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function sql_where() {
                        
                                global $wpdb;
                        
                                $sql = 'WHERE 1';
                        Severity: Minor
                        Found in includes/class-llms-events-query.php - About 1 hr to fix

                          Method register_post_type has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function register_post_type() {
                          
                                  $args = array(
                                      'label'               => __( 'LifterLMS Forms', 'lifterlms' ),
                                      'labels'              => array(
                          Severity: Minor
                          Found in includes/forms/class-llms-form-post-type.php - About 1 hr to fix

                            Method llms_get_certificate_sizes has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function llms_get_certificate_sizes() {
                            
                                $sizes = array(
                                    // ISO 216 sizes.
                                    'A3'           => array(
                            Severity: Minor
                            Found in includes/functions/llms.functions.certificate.php - About 1 hr to fix

                              Function entry has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              config.entry = () => {
                                  try {
                                      const entries = Object.fromEntries(
                                          Object.entries( blockEntries ).map( ( [ key, val ] ) => {
                                              return [ key.replace( 'blocks/', '' ), val ];
                              Severity: Minor
                              Found in packages/scripts/config/blocks-webpack.config.js - About 1 hr to fix

                                Method get_sibling_section_query has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function get_sibling_section_query( $direction ) {
                                
                                        $sibling_lesson = false;
                                        $curr_section   = $this->get_section();
                                
                                
                                Severity: Minor
                                Found in includes/models/model.llms.lesson.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language