gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Function get_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_data( $key, $student ) {

        $value = '';

        switch ( $key ) {
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.membership.students.php - About 1 hr 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_checkout_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_checkout_url( $check_availability = true ) {

        $ret       = '#llms-plan-locked';
        $available = $this->is_available_to_user( get_current_user_id() );

Severity: Minor
Found in includes/models/model.llms.access.plan.php - About 1 hr 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_sync_action_texts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function get_sync_action_texts() {

        if ( $this->is_current_post_a_template ) {
            $awarded_number = $this->count_awarded_engagements( $this->post->ID );

Severity: Minor
Found in includes/abstracts/llms-abstract-meta-box-user-engagement-sync.php - About 1 hr 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_next_payment_date has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function calculate_next_payment_date( $format = 'Y-m-d H:i:s' ) {

        // If the limited plan has already ended return early.
        $remaining = $this->get_remaining_payments();
        if ( 0 === $remaining ) {
Severity: Minor
Found in includes/models/model.llms.order.php - About 1 hr 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 randomize_attempt_questions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function randomize_attempt_questions( $questions ) {

        if ( empty( $questions ) ) {
            return $questions;
        }
Severity: Minor
Found in includes/models/model.llms.quiz.attempt.php - About 1 hr 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 maybe_handle_awarded_engagement_sync_actions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_handle_awarded_engagement_sync_actions() {

        // Validate action.
        // Invalid actions return a WP_Error for testing purposes and are not displayed to the user.
        $actions = array(
Severity: Minor
Found in includes/abstracts/llms-abstract-controller-user-engagements.php - About 1 hr 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 modify_dom_links has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function modify_dom_links( $dom ) {

        // Get all <links>.
        $links      = $dom->getElementsByTagName( 'link' );
        $to_replace = array();
Severity: Minor
Found in includes/class.llms.certificates.php - About 1 hr 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 sideload_images has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sideload_images( $post, $raw ) {

        // Sideloading is disabled.
        if ( ! $this->is_image_sideloading_enabled() ) {
            return null;
Severity: Minor
Found in includes/abstracts/llms-abstract-generator-posts.php - About 1 hr 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_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_status() {

        $question = $this->get_question();

        if ( ! $question ) {
Severity: Minor
Found in includes/models/model.llms.quiz.attempt.question.php - About 1 hr 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_setup_course_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function llms_setup_course_data( $post ) {
    if ( ! is_admin() ) {

        if ( $post && 'course' === $post->post_type ) {

Severity: Minor
Found in includes/llms.template.functions.php - About 1 hr 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 quiz_maybe_prevent_lesson_completion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function quiz_maybe_prevent_lesson_completion( $allow_completion, $user_id, $lesson_id, $trigger, $args ) {

        // If allow completion is already false, we don't need to run any quiz checks.
        if ( ! $allow_completion ) {
            return $allow_completion;
Severity: Minor
Found in includes/controllers/class.llms.controller.lesson.progression.php - About 1 hr 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_overall_progress has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_overall_progress( $use_cache = true ) {

        $progress = null;

        // Attempt to pull from the cache first.
Severity: Minor
Found in includes/models/model.llms.student.php - About 1 hr 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 validate_coupon_code has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function validate_coupon_code( $request ) {

        $error = new WP_Error();

        $request['code'] = ! empty( $request['code'] ) ? sanitize_text_field( $request['code'] ) : '';
Severity: Minor
Found in includes/class.llms.ajax.handler.php - About 1 hr 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_date_range_by_filter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_date_range_by_filter( $filter ) {

        $today         = current_time( 'Y-m-d' );
        $current_month = date( 'm', strtotime( $today ) );
        $current_year  = date( 'Y', strtotime( $today ) );
Severity: Minor
Found in includes/class.llms.date.php - About 1 hr 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 prepare has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepare() {

        if ( empty( $this->settings['id'] ) ) {
            $this->settings['id'] = uniqid( 'llms-field-' );
        }
Severity: Minor
Found in includes/forms/class-llms-form-field.php - About 1 hr 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_confirm_group has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function get_confirm_group( $id, $blocks ) {

        foreach ( $blocks as $index => $block ) {

            if ( $block['innerBlocks'] ) {
Severity: Minor
Found in includes/forms/class-llms-forms-dynamic-fields.php - About 1 hr 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 save_grade has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function save_grade( $attempt ) {

        // phpcs:disable WordPress.Security.NonceVerification.Missing -- Nonce verified in `maybe_run_actions()` method.

        $remarks = isset( $_POST['remarks'] ) ? llms_filter_input_sanitize_string( INPUT_POST, 'remarks', array( FILTER_REQUIRE_ARRAY ) ) : array();
Severity: Minor
Found in includes/controllers/class.llms.controller.admin.quiz.attempts.php - About 1 hr 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 validate_fields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate_fields( $posted_data, $fields ) {

        if ( empty( $posted_data ) && ! empty( $fields ) ) {
            return new WP_Error( 'llms-form-no-input', __( 'Cannot validate a form with no user input.', 'lifterlms' ) );
        }
Severity: Minor
Found in includes/forms/class-llms-form-validator.php - About 1 hr 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 create_course has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function create_course( $raw ) {

        /**
         * Filter raw course import data prior to generation
         *
Severity: Minor
Found in includes/class-llms-generator-courses.php - About 1 hr 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 remove_block has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function remove_block( $block, &$blocks, &$parent = null ) {

        foreach ( $blocks as $index => &$_block ) {

            if ( $_block === $block ) {
Severity: Minor
Found in includes/forms/class-llms-forms-dynamic-fields.php - About 1 hr 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