gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Function updateDOM has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateDOM() {
    const { getCurrentPostAttribute, getEditedPostAttribute, getCurrentPostType } = select( editorStore ),
        bg = getEditedPostAttribute( 'certificate_background' ),
        margins = getEditedPostAttribute( 'certificate_margins' ),
        width = getEditedPostAttribute( 'certificate_width' ),
Severity: Minor
Found in src/js/admin-certificate-editor/editor.js - About 1 hr to fix

    Function draw_chart has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            this.draw_chart = function() {
    
                if ( ! this.charts_loaded || ! this.is_loading_finished() ) {
                    return;
                }
    Severity: Minor
    Found in assets/js/llms-analytics.js - About 1 hr to fix

      Function start_quiz_timer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              start_quiz_timer: function( total_minutes ) {
      
                  // create and append the UI for the countdown clock
                  var $el = $( '<div class="llms-quiz-timer" id="llms-quiz-timer" />' ),
                      msg = LLMS.l10n.translate( 'Time Remaining' );
      Severity: Minor
      Found in assets/js/llms-quiz.js - About 1 hr to fix

        Function bind has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            bind: function() {
        
                var self = this;
        
                self.$repeaters.each( function() {
        Severity: Minor
        Found in assets/js/partials/_metabox-field-repeater.js - About 1 hr to fix

          Method sql_where has 35 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.query.user.postmeta.php - About 1 hr to fix

            Method maybe_restrict_post_content has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function maybe_restrict_post_content( $post, $query ) {
                    /**
                     * Filters the post types that must be skipped.
                     *
                     * The LifterLMS post types content restriction should be handled by the LifterLMS rest-api.
            Severity: Minor
            Found in includes/class.llms.template.loader.php - About 1 hr to fix

              Method get_settings_group_email has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function get_settings_group_email() {
              
                      return $this->generate_settings_group(
                          'email_options',
                          __( 'Email Settings', 'lifterlms' ),
              Severity: Minor
              Found in includes/admin/settings/class.llms.settings.engagements.php - About 1 hr to fix

                Method output_copy_box has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function output_copy_box() {
                        ?>
                        <div class="llms-setting-group top">
                            <p class="llms-label"><?php esc_html_e( 'Support', 'lifterlms' ); ?></p>
                            <div id="llms-debug-report">
                Severity: Minor
                Found in includes/admin/class.llms.admin.system-report.php - About 1 hr to fix

                  Method breadcrumbs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function breadcrumbs() {
                  
                          $links = array();
                  
                          // Single student.

                    Method __construct has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct() {
                            $this->id        = 'setup';
                            $this->views_dir = LLMS_PLUGIN_DIR . 'includes/admin/views/setup-wizard/';
                            $this->title     = esc_html__( 'LifterLMS Setup Wizard', 'lifterlms' );
                            $this->steps     = array(
                    Severity: Minor
                    Found in includes/admin/class.llms.admin.setup.wizard.php - About 1 hr to fix

                      Method process_detachments has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private static function process_detachments( $data ) {
                      
                              $ret = array();
                      
                              foreach ( $data['detach'] as $id ) {
                      Severity: Minor
                      Found in includes/admin/class.llms.admin.builder.php - About 1 hr to fix

                        Method add_note has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function add_note( $note, $added_by_user = false ) {
                        
                                if ( ! $note ) {
                                    return;
                                }
                        Severity: Minor
                        Found in includes/models/model.llms.order.php - About 1 hr to fix

                          Method output_tfoot_html has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function output_tfoot_html() {
                                  ?>
                                  <tfoot>
                                  <tr>
                                      <th colspan="<?php echo esc_attr( $this->get_columns_count() ); ?>">
                          Severity: Minor
                          Found in includes/abstracts/abstract.llms.admin.table.php - About 1 hr to fix

                            Method get_access_plans has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function get_access_plans( $free_only = false, $visible_only = true ) {
                            
                                    $args = array(
                                        'meta_key'       => '_llms_product_id', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
                                        'meta_value'     => $this->get( 'id' ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
                            Severity: Minor
                            Found in includes/models/model.llms.product.php - About 1 hr to fix

                              Method record has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function record( $args = array() ) {
                              
                                      $err = new WP_Error();
                              
                                      foreach ( array( 'actor_id', 'object_type', 'object_id', 'event_type', 'event_action' ) as $key ) {
                              Severity: Minor
                              Found in includes/class-llms-events.php - About 1 hr to fix

                                Method dupcheck has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private static function dupcheck( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
                                
                                        $student = llms_get_student( $user_id );
                                
                                        $query = new LLMS_Awards_Query(
                                Severity: Minor
                                Found in includes/class-llms-engagement-handler.php - About 1 hr to fix

                                  Method llms_get_certificate_fonts has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function llms_get_certificate_fonts() {
                                      /**
                                       * Determines whether or not webfonts are loaded from Google CDNs.
                                       *
                                       * @since 6.11.0
                                  Severity: Minor
                                  Found in includes/functions/llms.functions.certificate.php - About 1 hr to fix

                                    Method llms_update_300_migrate_lesson_postmeta has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function llms_update_300_migrate_lesson_postmeta() {
                                    
                                        global $wpdb;
                                    
                                        llms_update_util_rekey_meta( 'lesson', '_llms_audio_embed', '_audio_embed' );
                                    Severity: Minor
                                    Found in includes/functions/updates/llms-functions-updates-300.php - About 1 hr to fix

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

                                          if ( Array.isArray( logEntry.attributions ) ) {
                                              logEntry.attributions.forEach( ( attribution ) => {
                                                  if ( ! isAttributionValid( attribution ) ) {
                                                      errors.push( `The attribution ${ highlight( attribution, formatting ) } is invalid.` );
                                                  }
                                      Severity: Major
                                      Found in packages/dev/src/utils/validate-changelog.js and 1 other location - About 1 hr to fix
                                      packages/dev/src/utils/validate-changelog.js on lines 190..196

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

                                      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

                                          if ( Array.isArray( logEntry.links ) ) {
                                              logEntry.links.forEach( ( link ) => {
                                                  if ( ! isLinkValid( link ) ) {
                                                      errors.push( `The link ${ highlight( link, formatting ) } is invalid.` );
                                                  }
                                      Severity: Major
                                      Found in packages/dev/src/utils/validate-changelog.js and 1 other location - About 1 hr to fix
                                      packages/dev/src/utils/validate-changelog.js on lines 199..205

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

                                      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