gocodebox/lifterlms

View on GitHub

Showing 1,099 of 1,425 total issues

Method register_post_types has 615 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function register_post_types() {
        $permalinks = llms_get_permalink_structure();

        // Course.
        $catalog_id = llms_get_page_id( 'shop' );
Severity: Major
Found in includes/class.llms.post-types.php - About 3 days to fix

    File class.llms.post-types.php has 1102 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Register Post Types, Taxonomies, Statuses.
     *
     * @package LifterLMS/Classes
    Severity: Major
    Found in includes/class.llms.post-types.php - About 2 days to fix

      Function Metaboxes has 507 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var Metaboxes = function() {
      
              /**
               * load all partials
               */
      Severity: Major
      Found in assets/js/private/llms-metaboxes.js - About 2 days to fix

        File model.llms.order.php has 917 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * LLMS_Order class/model file
         *
         * @package LifterLMS/Models/Classes
        Severity: Major
        Found in includes/models/model.llms.order.php - About 2 days to fix

          Method output_field has 417 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function output_field( $field ) {
          
                  // Set missing values with defaults.
                  $field = self::set_field_defaults( $field );
          
          
          Severity: Major
          Found in includes/admin/class.llms.admin.settings.php - About 2 days to fix

            File model.llms.student.php has 854 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Student Model
             *
             * @package LifterLMS/Models/Classes
            Severity: Major
            Found in includes/models/model.llms.student.php - About 2 days to fix

              Function metabox_product has 409 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  window.llms.metabox_product = function() {
              
                      /**
                       * jQuery obj for the main $( '#llms-access-plans' ) element.
                       *
              Severity: Major
              Found in assets/js/llms-metabox-product.js - About 2 days to fix

                File class.llms.ajax.handler.php has 803 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * LifterLMS AJAX Event Handler.
                 *
                 * @package LifterLMS/Classes
                Severity: Major
                Found in includes/class.llms.ajax.handler.php - About 1 day to fix

                  Method get_fields has 354 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function get_fields() {
                  
                          global $post;
                  
                          $course = new LLMS_Course( $this->post );

                    File class.llms.admin.builder.php has 683 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * LifterLMS Admin Course Builder
                     *
                     * @package LifterLMS/Admin/Classes
                    Severity: Major
                    Found in includes/admin/class.llms.admin.builder.php - About 1 day to fix

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

                          public function get_settings() {
                              $account_settings = array(
                                  array(
                                      'class' => 'top',
                                      'id'    => 'course_account_options',
                      Severity: Major
                      Found in includes/admin/settings/class.llms.settings.accounts.php - About 1 day to fix

                        File class.llms.admin.settings.php has 668 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Admin Settings and fields
                         *
                         * @package LifterLMS/Admin/Classes
                        Severity: Major
                        Found in includes/admin/class.llms.admin.settings.php - About 1 day to fix

                          File abstract.llms.post.model.php has 660 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /**
                           * LLMS_Post_Model abstract class file
                           *
                           * @package LifterLMS/Abstracts/Classes
                          Severity: Major
                          Found in includes/abstracts/abstract.llms.post.model.php - About 1 day to fix

                            Function Analytics has 287 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var Analytics = function( opts ) {
                            
                                    if ( ! $( '#llms-analytics-json' ).length ) {
                                        return;
                                    }
                            Severity: Major
                            Found in assets/js/llms-analytics.js - About 1 day to fix

                              Function output_field has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function output_field( $field ) {
                              
                                      // Set missing values with defaults.
                                      $field = self::set_field_defaults( $field );
                              
                              
                              Severity: Minor
                              Found in includes/admin/class.llms.admin.settings.php - About 1 day to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function llms_checkout has 262 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  var llms_checkout = function() {
                              
                                      /**
                                       * Array of validation functions to call on form submission
                                       *
                              Severity: Major
                              Found in assets/js/llms-form-checkout.js - About 1 day to fix

                                Function llms_update_3160_attempt_migration has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function llms_update_3160_attempt_migration() {
                                
                                    global $wpdb;
                                    $query = $wpdb->get_results( "SELECT user_id, meta_value FROM {$wpdb->usermeta} WHERE meta_key = 'llms_quiz_data' LIMIT 100;" ); // db call ok; no-cache ok.
                                
                                
                                Severity: Minor
                                Found in includes/functions/updates/llms-functions-updates-3160.php - About 1 day to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                File llms.functions.templates.dashboard.php has 584 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /**
                                 * Template functions for the student dashboard
                                 *
                                 * @package LifterLMS/Functions
                                Severity: Major
                                Found in includes/functions/llms.functions.templates.dashboard.php - About 1 day to fix

                                  File llms.template.functions.php has 550 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  /**
                                   * Front end template functions
                                   *
                                   * @package LifterLMS/Functions/Templates
                                  Severity: Major
                                  Found in includes/llms.template.functions.php - About 1 day to fix

                                    Function llms_update_3160_update_question_data has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
                                    Open

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

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language