gocodebox/lifterlms

View on GitHub
includes/class.llms.frontend.assets.php

Summary

Maintainability
A
3 hrs
Test Coverage
C
73%

Method enqueue_scripts has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function enqueue_scripts() {

        // I don't think we need these next 3 scripts.
        wp_enqueue_script( 'jquery-ui-tooltip' );
        wp_enqueue_script( 'jquery-ui-datepicker' );
Severity: Minor
Found in includes/class.llms.frontend.assets.php - About 1 hr to fix

    Method enqueue_content_protection has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function enqueue_content_protection() {
    
            $allow_copying = ! llms_parse_bool( get_option( 'lifterlms_content_protection', 'no' ) ) || llms_can_user_bypass_restrictions( get_current_user_id() );
    
            /**
    Severity: Minor
    Found in includes/class.llms.frontend.assets.php - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if ( is_llms_account_page() || is_course() || is_membership() || is_lesson() || is_memberships() || is_courses() || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {
                  llms()->assets->enqueue_script( 'llms-jquery-matchheight' );
              }
      Severity: Major
      Found in includes/class.llms.frontend.assets.php - About 1 hr to fix

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

            public static function enqueue_scripts() {
        
                // I don't think we need these next 3 scripts.
                wp_enqueue_script( 'jquery-ui-tooltip' );
                wp_enqueue_script( 'jquery-ui-datepicker' );
        Severity: Minor
        Found in includes/class.llms.frontend.assets.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