gocodebox/lifterlms

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

Summary

Maintainability
D
2 days
Test Coverage
F
34%

Function admin_scripts has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function admin_scripts() {

        global $post_type;
        $screen = get_current_screen();

Severity: Minor
Found in includes/admin/class.llms.admin.assets.php - About 4 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 admin_scripts has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function admin_scripts() {

        global $post_type;
        $screen = get_current_screen();

Severity: Major
Found in includes/admin/class.llms.admin.assets.php - About 4 hrs to fix

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

    <?php
    /**
     * LLMS_Admin_Assets class
     *
     * @package LifterLMS/Admin/Classes
    Severity: Minor
    Found in includes/admin/class.llms.admin.assets.php - About 2 hrs to fix

      Method block_editor_assets_for_certificates has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function block_editor_assets_for_certificates() {
      
              llms()->assets->enqueue_script( 'llms-admin-certificate-editor' );
      
              $settings = array(
      Severity: Minor
      Found in includes/admin/class.llms.admin.assets.php - About 1 hr to fix

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

            public function admin_print_scripts() {
        
                $screen = get_current_screen();
        
                global $post;
        Severity: Minor
        Found in includes/admin/class.llms.admin.assets.php - About 1 hr to fix

          Function maybe_enqueue_reporting has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function maybe_enqueue_reporting( $screen ) {
          
                  if ( in_array( $screen->base, array( 'lifterlms_page_llms-reporting', 'lifterlms_page_llms-dashboard', 'dashboard' ), true ) ) {
          
                      $current_tab = llms_filter_input( INPUT_GET, 'tab' );
          Severity: Minor
          Found in includes/admin/class.llms.admin.assets.php - About 55 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

          Avoid too many return statements within this method.
          Open

                  return false;
          Severity: Major
          Found in includes/admin/class.llms.admin.assets.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return true;
            Severity: Major
            Found in includes/admin/class.llms.admin.assets.php - About 30 mins to fix

              Function is_llms_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function is_llms_page() {
              
                      $screen = get_current_screen();
              
                      $id = str_replace( 'edit-', '', $screen->id );
              Severity: Minor
              Found in includes/admin/class.llms.admin.assets.php - About 25 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