gocodebox/lifterlms

View on GitHub

Showing 1,389 of 1,394 total issues

File llms-form-checkout.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * LifterLMS Checkout Screen related events and interactions
 *
 * @package LifterLMS/Scripts
 *
Severity: Minor
Found in assets/js/llms-form-checkout.js - About 2 hrs to fix

    Function Tracking has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    LLMS.Tracking = function( settings ) {
    
        settings = settings || {};
    
        var self = this,
    Severity: Minor
    Found in assets/js/app/llms-tracking.js - 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

    Function get_transactions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get_transactions( $args = array() ) {
    
            extract(
                wp_parse_args(
                    $args,
    Severity: Minor
    Found in includes/models/model.llms.order.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

    Function parse_properties_to_set has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        private function parse_properties_to_set( $model_array ) {
    
            $llms_post = array(
                'post' => array(),
                'meta' => array(),
    Severity: Minor
    Found in includes/abstracts/abstract.llms.post.model.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

    Function pre_get_posts has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function pre_get_posts( $query ) {
    
            static $done      = false;
            $modify_tax_query = false;
    
    
    Severity: Minor
    Found in includes/class.llms.query.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

    Function output has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function output() {
    
            /**
             * Check to see if we are supposed to output the code at all.
             */
    Severity: Minor
    Found in includes/class.llms.review.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 set_query has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function set_query() {
    
            global $wpdb;
    
            $txn_meta_join  = '';

      Method get_post_type_caps has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function get_post_type_caps( $role ) {
      
              $caps = array();
      
              // Students get nothing.
      Severity: Major
      Found in includes/class.llms.roles.php - About 2 hrs to fix

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            protected function get_subscriber( $subscriber ) {
        
                switch ( $subscriber ) {
        
                    case 'author':
        includes/notifications/controllers/class.llms.notification.controller.payment.retry.php on lines 68..95
        includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php on lines 130..157

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

        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

            public function add_columns( $columns ) {
        
                $columns = array(
                    'cb'             => '<input type="checkbox" />',
                    'order'          => __( 'Order', 'lifterlms' ),
        includes/admin/post-types/post-tables/class.llms.admin.post.table.lessons.php on lines 93..107

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

        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

            public function add_columns( $columns ) {
        
                $columns = array(
                    'cb'      => '<input type="checkbox" />',
                    'title'   => __( 'Lesson Title', 'lifterlms' ),
        includes/admin/post-types/post-tables/class.llms.admin.post.table.orders.php on lines 47..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 129.

        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

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            protected function get_subscriber( $subscriber ) {
        
                switch ( $subscriber ) {
        
                    case 'author':
        includes/notifications/controllers/class.llms.notification.controller.manual.payment.due.php on lines 68..95
        includes/notifications/controllers/class.llms.notification.controller.payment.retry.php on lines 68..95

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

        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

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            protected function get_subscriber( $subscriber ) {
        
                switch ( $subscriber ) {
        
                    case 'author':
        includes/notifications/controllers/class.llms.notification.controller.manual.payment.due.php on lines 68..95
        includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php on lines 130..157

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

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

        const Edit = ( props ) => {
            const { attributes, setAttributes } = props;
            const blockProps = useBlockProps();
            const courseOptions = usePostOptions();
        
        
        Severity: Major
        Found in src/blocks/course-author/index.jsx - About 2 hrs to fix

          Method get_results has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get_results( $args = array() ) {
          
                  $this->title = __( 'Courses', 'lifterlms' );
          
                  $args = $this->clean_args( $args );
          Severity: Major
          Found in includes/admin/reporting/tables/llms.table.courses.php - About 2 hrs to fix

            LLMS_Voucher has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class LLMS_Voucher {
            
                // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
                // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
            
            
            Severity: Minor
            Found in includes/class.llms.voucher.php - About 2 hrs to fix

              LLMS_Abstract_Generator_Posts has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              abstract class LLMS_Abstract_Generator_Posts {
              
                  /**
                   * Exception code: WP_Post creation error
                   *
              Severity: Minor
              Found in includes/abstracts/llms-abstract-generator-posts.php - About 2 hrs to fix

                LLMS_Order_Generator has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class LLMS_Order_Generator {
                
                    /**
                     * Error code: invalid coupon code submitted.
                     *
                Severity: Minor
                Found in includes/class-llms-order-generator.php - About 2 hrs to fix

                  LifterLMS has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  final class LifterLMS {
                  
                      use LLMS_Trait_Singleton;
                  
                      /**
                  Severity: Minor
                  Found in class-lifterlms.php - About 2 hrs to fix

                    Function export has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            this.export = function( $table, $btn, filename ) {
                    
                                var self = this,
                                    $msg = $table.find( '.llms-table-export .llms-table-export-msg' ),
                                    $progress = $table.find( '.llms-table-export .llms-table-progress' );
                    Severity: Major
                    Found in assets/js/llms-admin-tables.js - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language