gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

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

    public function get_status_icon() {

        $icon = '';

        switch ( $this->get_status() ) {
Severity: Minor
Found in includes/models/model.llms.quiz.attempt.question.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 notifications_heartbeart has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function notifications_heartbeart( $request ) {

        $ret = array(
            'new' => array(),
        );
Severity: Minor
Found in includes/class.llms.ajax.handler.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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function init() {

        $integrations = apply_filters(
            'lifterlms_integrations',
            array(
Severity: Minor
Found in includes/class.llms.integrations.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_enrollment_trigger_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_enrollment_trigger_id( $product_id ) {

        $trigger = $this->get_enrollment_trigger( $product_id );
        $id      = false;
        if ( $trigger && false !== strpos( $trigger, 'order_' ) ) {
Severity: Minor
Found in includes/models/model.llms.student.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 maybe_handle_reporting_actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_handle_reporting_actions() {

        if ( ! llms_verify_nonce( '_llms_quiz_actions_nonce', 'llms-quiz-actions' ) ) {
            return null;
        }
Severity: Minor
Found in includes/controllers/class.llms.controller.quizzes.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 error_order has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function error_order( $order ) {

        $order = is_a( $order, 'LLMS_Order' ) ? $order : llms_get_post( $order );
        if ( ! ( $order && is_a( $order, 'LLMS_Order' ) ) ) {
            return;
Severity: Minor
Found in includes/controllers/class.llms.controller.orders.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 set_bulk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function set_bulk( $model_array, $wp_error = false, $allow_same_meta_value = false ) {

        if ( empty( $model_array ) ) {
            return $wp_error ? new WP_Error( 'empty_data', __( 'Empty data', 'lifterlms' ) ) : false;
        }
Severity: Minor
Found in includes/abstracts/abstract.llms.post.model.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_question has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_question( $id ) {

        $question = llms_get_post( $id );

        // Not valid question, return false.
Severity: Minor
Found in includes/class.llms.question.manager.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_next_question has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_next_question( $last_question = null ) {

        $next = false;

        foreach ( $this->get_questions() as $question ) {
Severity: Minor
Found in includes/models/model.llms.quiz.attempt.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 duplicate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function duplicate( $post_id ) {

        // Make sure we have a post id and it returns a post.
        if ( ! isset( $post_id ) ) {
            return false;
Severity: Minor
Found in includes/class.llms.lesson.handler.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_default_default_image_src has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_default_default_image_src() {

        $img        = "default-{$this->award_type}.png";
        $use_legacy = false;

Severity: Minor
Found in includes/traits/llms-trait-award-default-images.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_lesson_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function get_lesson_data( $lessons ) {
    global $post;
    $html = '';
    $args = array(
        'post_type'   => 'lesson',
Severity: Minor
Found in includes/llms.template.functions.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 restriction_checks_memberships has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function restriction_checks_memberships( $results ) {

        $post_id = null;

        // Forum archive, grab the page (if set).
Severity: Minor
Found in includes/integrations/class.llms.integration.bbpress.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_table_html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_table_html() {

        $table = parent::get_table_html();

        $post_type = null;
Severity: Minor
Found in includes/traits/llms-trait-earned-engagement-reporting-table.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 on_save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function on_save( $post_id ) {

        $obj = self::get_object( $post_id );
        if ( ! $obj || 'publish' !== $obj->get( 'status' ) ) {
            return false;
Severity: Minor
Found in includes/controllers/class-llms-controller-awards.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_answer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_answer() {

        $question = $this->get_question();
        $answers  = $this->get_answer_array();
        $ret      = apply_filters( 'llms_quiz_attempt_question_get_answer_pre', '', $answers, $question, $this );
Severity: Minor
Found in includes/models/model.llms.quiz.attempt.question.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 from_file_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function from_file_path( $file ) {

        if ( ! is_readable( $file ) || is_dir( $file ) || is_link( $file ) ) {
            return self::DEFAULT_MIME_TYPE;
        }
Severity: Minor
Found in includes/class-llms-mime-type-extractor.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 cancel_subscription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function cancel_subscription() {

        // Invalid nonce or the form wasn't submitted.
        if ( ! llms_verify_nonce( '_cancel_sub_nonce', 'llms_cancel_subscription', 'POST' ) ) {
            return;
Severity: Minor
Found in includes/forms/controllers/class.llms.controller.account.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 set_metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_metadata( $post, $raw ) {

        $generated_from_id = $post->get( 'generated_from_id' );

        if ( $generated_from_id ) {
Severity: Minor
Found in includes/class-llms-generator-courses.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 validate_password_reset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validate_password_reset( $posted_data ) {

        $err = new WP_Error();

        $fields = LLMS_Person_Handler::get_password_reset_fields();
Severity: Minor
Found in includes/forms/controllers/class.llms.controller.account.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