gocodebox/lifterlms

View on GitHub
includes/functions/updates/llms-functions-updates-300.php

Summary

Maintainability
F
4 days
Test Coverage
F
0%

Function llms_update_300_create_access_plans has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

function llms_update_300_create_access_plans() {

    $courses = new WP_Query(
        array(
            'post_type'      => array( 'course', 'llms_membership' ),
Severity: Minor
Found in includes/functions/updates/llms-functions-updates-300.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-updates-300.php has 428 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Update functions for version 3.0.0
 *
 * @package LifterLMS/Functions/Updates
Severity: Minor
Found in includes/functions/updates/llms-functions-updates-300.php - About 6 hrs to fix

    Method llms_update_300_create_access_plans has 149 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function llms_update_300_create_access_plans() {
    
        $courses = new WP_Query(
            array(
                'post_type'      => array( 'course', 'llms_membership' ),
    Severity: Major
    Found in includes/functions/updates/llms-functions-updates-300.php - About 5 hrs to fix

      Function llms_update_300_update_orders has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      function llms_update_300_update_orders() {
      
          $args = array(
              'post_type'      => array( 'llms_order' ),
              'posts_per_page' => -1,
      Severity: Minor
      Found in includes/functions/updates/llms-functions-updates-300.php - About 3 hrs 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_update_300_migrate_account_field_options has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      function llms_update_300_migrate_account_field_options() {
      
          $email_confirm = get_option( 'lifterlms_registration_confirm_email' );
          if ( 'yes' === $email_confirm ) {
              $email_confirm = 'yes';
      Severity: Minor
      Found in includes/functions/updates/llms-functions-updates-300.php - About 2 hrs 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

      Method llms_update_300_update_orders has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function llms_update_300_update_orders() {
      
          $args = array(
              'post_type'      => array( 'llms_order' ),
              'posts_per_page' => -1,
      Severity: Major
      Found in includes/functions/updates/llms-functions-updates-300.php - About 2 hrs to fix

        Method llms_update_300_migrate_course_postmeta has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function llms_update_300_migrate_course_postmeta() {
        
            global $wpdb;
        
            // Rekey meta fields.
        Severity: Major
        Found in includes/functions/updates/llms-functions-updates-300.php - About 2 hrs to fix

          Method llms_update_300_migrate_account_field_options has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function llms_update_300_migrate_account_field_options() {
          
              $email_confirm = get_option( 'lifterlms_registration_confirm_email' );
              if ( 'yes' === $email_confirm ) {
                  $email_confirm = 'yes';
          Severity: Minor
          Found in includes/functions/updates/llms-functions-updates-300.php - About 2 hrs 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

              Function llms_update_300_migrate_course_postmeta has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function llms_update_300_migrate_course_postmeta() {
              
                  global $wpdb;
              
                  // Rekey meta fields.
              Severity: Minor
              Found in includes/functions/updates/llms-functions-updates-300.php - About 35 mins 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

              There are no issues that match your filters.

              Category
              Status