gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

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

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

                    'labels'              => array(
                        'name'                  => __( 'Achievement Templates', 'lifterlms' ),
                        'singular_name'         => __( 'Achievement Template', 'lifterlms' ),
                        'add_new'               => __( 'Add Achievement Template', 'lifterlms' ),
                        'add_new_item'          => __( 'Add New Achievement Template', 'lifterlms' ),
    Severity: Major
    Found in includes/class.llms.post-types.php and 1 other location - About 1 day to fix
    includes/class.llms.post-types.php on lines 839..858

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

    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

                    'labels'              => array(
                        'name'                  => __( 'Awarded Achievements', 'lifterlms' ),
                        'singular_name'         => __( 'Awarded Achievement', 'lifterlms' ),
                        'add_new'               => __( 'Award Achievement', 'lifterlms' ),
                        'add_new_item'          => __( 'Award New Achievement', 'lifterlms' ),
    Severity: Major
    Found in includes/class.llms.post-types.php and 1 other location - About 1 day to fix
    includes/class.llms.post-types.php on lines 800..819

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

    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

    Method get_strings has 235 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_strings( $strings ) {
            // phpcs:disable
            return array_merge( $strings, array(
    
                /**
    Severity: Major
    Found in includes/class.llms.l10n.js.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

      File llms.template.functions.php has 545 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

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

        <?php
        /**
         * Core LifterLMS functions file
         *
         * @package LifterLMS/Functions
        Severity: Major
        Found in includes/llms.functions.core.php - About 1 day to fix

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

          define( [], function() {
          
              return {
          
                  /**
          Severity: Major
          Found in assets/js/builder/Views/_Trashable.js and 1 other location - About 1 day to fix
          assets/js/builder/Views/_Detachable.js on lines 10..63

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

          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

          define( [], function() {
          
              return {
          
                  /**
          Severity: Major
          Found in assets/js/builder/Views/_Detachable.js and 1 other location - About 1 day to fix
          assets/js/builder/Views/_Trashable.js on lines 8..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 212.

          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

          <?php
          /**
           * Blog meta box HTML.
           *
           * @package LifterLMS/Admin/Views/Dashboard
          Severity: Major
          Found in includes/admin/views/dashboard/blog.php and 1 other location - About 1 day to fix
          includes/admin/views/dashboard/podcast.php on lines 1..56

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

          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

          <?php
          /**
           * Podcast meta box HTML.
           *
           * @package LifterLMS/Admin/Views/Dashboard
          Severity: Major
          Found in includes/admin/views/dashboard/podcast.php and 1 other location - About 1 day to fix
          includes/admin/views/dashboard/blog.php on lines 1..56

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

          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

          File llms-metaboxes.js has 527 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * LifterLMS Admin Panel Metabox Functions
           *
           * @since 3.0.0
           * @version 7.1.1
          Severity: Major
          Found in assets/js/private/llms-metaboxes.js - About 1 day to fix

            Method register_taxonomies has 210 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function register_taxonomies() {
            
                    $permalinks = llms_get_permalink_structure();
            
                    // Course cat.
            Severity: Major
            Found in includes/class.llms.post-types.php - About 1 day to fix

              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

              LLMS_Order has 57 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class LLMS_Order extends LLMS_Post_Model {
              
                  /**
                   * Database post type.
                   *
              Severity: Major
              Found in includes/models/model.llms.order.php - About 1 day to fix

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

                <?php
                /**
                 * Notification Controller: Achievement Earned
                 *
                 * @package LifterLMS/Notifications/Controllers/Classes
                includes/notifications/controllers/class.llms.notification.controller.certificate.earned.php on lines 1..139

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

                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

                <?php
                /**
                 * Notification Controller: Certificate Earned
                 *
                 * @package LifterLMS/Notifications/Controllers/Classes
                includes/notifications/controllers/class.llms.notification.controller.achievement.earned.php on lines 1..139

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

                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

                LLMS_Post_Model has 52 functions (exceeds 20 allowed). Consider refactoring.
                Open

                abstract class LLMS_Post_Model implements JsonSerializable {
                
                    /**
                     * Name of the post type as stored in the database
                     * This will be prefixed (where applicable)
                Severity: Major
                Found in includes/abstracts/abstract.llms.post.model.php - About 7 hrs to fix

                  Function save_fields has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function save_fields( $settings ) {
                  
                          // phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce is checked in self::save().
                          if ( empty( $_POST ) ) {
                              return false;
                  Severity: Minor
                  Found in includes/admin/class.llms.admin.settings.php - About 7 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 Edit has 180 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Edit = ( props ) => {
                      const { attributes, setAttributes } = props;
                      const blockProps = useBlockProps();
                      const [ courseTitles, setCourseTitles ] = useState( [] );
                  
                  
                  Severity: Major
                  Found in src/blocks/courses/index.jsx - About 7 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language