gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

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

    public static function output() {

        $tabs = apply_filters(
            'llms_admin_page_status_tabs',
            array(
Severity: Minor
Found in includes/admin/class.llms.admin.page.status.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

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

    public function output() {

        $post_id = $this->post->ID;

        $lesson  = false;

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 manage_columns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function manage_columns( $column, $post_id ) {

        global $post;
        $c = new LLMS_Coupon( $post );

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_query_filters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse_query_filters( $query ) {

        // Only modify admin & main query.
        if ( ! ( is_admin() && $query->is_main_query() ) ) {
            return $query;

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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function save( $user ) {

        if ( is_numeric( $user ) ) {

            // Numeric ID is passed in during creations.
Severity: Minor
Found in includes/admin/class.llms.admin.user.custom.fields.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

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

    public function calculate_grade( $post, $student ) {

        $grade = null;

        $post_type = $post->get( 'type' );
Severity: Minor
Found in includes/class-llms-grades.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

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

    public function llms_sort_orders( $vars ) {

        if ( isset( $vars['post_type'] ) && 'llms_order' == $vars['post_type'] ) {

            if ( isset( $vars['orderby'] ) && 'order' == $vars['orderby'] ) {

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 save_update_enrollment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function save_update_enrollment( $post_id ) {

        $old_status = llms_filter_input_sanitize_string( INPUT_POST, 'llms_student_old_enrollment_status' );
        $new_status = llms_filter_input_sanitize_string( INPUT_POST, 'llms_student_new_enrollment_status' );

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_section has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function output_section( $section_title, $data ) {

        if ( 'plugins' === $section_title ) {

            $data = $data['active'];
Severity: Minor
Found in includes/admin/class.llms.admin.system-report.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

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

    public function settings() {
        ?>
        <p><?php _e( 'LifterLMS uses custom post types and taxonomies to organize your courses and memberships. You can customize the URLs for these items here.', 'lifterlms' ); ?></p>

        <?php
Severity: Minor
Found in includes/admin/class-llms-admin-permalinks.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

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

    public static function output() {

        global $post;

        $course_id = isset( $_GET['course_id'] ) ? absint( $_GET['course_id'] ) : null;
Severity: Minor
Found in includes/admin/class.llms.admin.builder.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

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

    public static function get_dates( $range ) {

        $now = current_time( 'timestamp' );

        $dates = array(
Severity: Minor
Found in includes/admin/reporting/class.llms.admin.reporting.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

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

    private function get_sort() {

        $sort = array();
        switch ( $this->get_orderby() ) {

Severity: Minor
Found in includes/admin/reporting/tables/llms.table.students.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

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

    public function get_export_data( $key, $student ) {

        switch ( $key ) {

            case 'id':
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.course.students.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

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

    public static function display_messages_html() {

        if ( count( self::$errors ) > 0 ) {

            foreach ( self::$errors as $error ) {
Severity: Minor
Found in includes/admin/class.llms.admin.settings.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

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

    public function get_product_from_cat( $cat, $excludes ) {

        $addons = $this->get_products_for_cat( $cat, true );
        shuffle( $addons );

Severity: Minor
Found in includes/admin/class.llms.admin.addons.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

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

    public function get_results( $args = array() ) {

        $this->title = __( 'Quiz Attempts', 'lifterlms' );

        $args = $this->clean_args( $args );
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.quiz.attempts.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

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

    public function output() {

        // Single student.
        if ( isset( $_GET['student_id'] ) ) {

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_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_results( $args = array() ) {

        // Current user can't access this report.
        if ( ! current_user_can( 'view_others_lifterlms_reports' ) && ! current_user_can( 'view_lifterlms_reports' ) ) {
            return;
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.students.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

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

    public function has_prerequisite( $type = 'any' ) {

        if ( 'yes' === $this->get( 'has_prerequisite' ) ) {

            if ( 'any' === $type ) {
Severity: Minor
Found in includes/models/model.llms.course.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

Severity
Category
Status
Source
Language