gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Function get_nav_items has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function get_nav_items() {

        $items = array();

        foreach ( LLMS_Student_Dashboard::get_tabs() as $id => $data ) {
Severity: Minor
Found in includes/class.llms.nav.menus.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 updateDOM has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function updateDOM() {
    const { getCurrentPostAttribute, getEditedPostAttribute, getCurrentPostType } = select( editorStore ),
        bg = getEditedPostAttribute( 'certificate_background' ),
        margins = getEditedPostAttribute( 'certificate_margins' ),
        width = getEditedPostAttribute( 'certificate_width' ),
Severity: Minor
Found in src/js/admin-certificate-editor/editor.js - 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 handle_link_actions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle_link_actions() {

        $action = llms_filter_input( INPUT_GET, 'action' );

        // Bail early if request doesn't concern us.
Severity: Minor
Found in includes/admin/post-types/class.llms.post.tables.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_restrict_post_content has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_restrict_post_content( $post, $query ) {
        /**
         * Filters the post types that must be skipped.
         *
         * The LifterLMS post types content restriction should be handled by the LifterLMS rest-api.
Severity: Minor
Found in includes/class.llms.template.loader.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 breadcrumbs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function breadcrumbs() {

        $links = array();

        // Single student.

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 12 (exceeds 5 allowed). Consider refactoring.
Open

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

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

        $args = $this->clean_args( $args );
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.quizzes.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 update_meta_properties has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function update_meta_properties( $post_meta_properties, $allow_same_meta_value ) {

        if ( empty( $post_meta_properties ) ) {
            return;
        }
Severity: Minor
Found in includes/abstracts/abstract.llms.post.model.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 scrub_field has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function scrub_field( $val, $type ) {

        if ( is_string( $val ) && 'html' !== $type ) {
            $val = wp_strip_all_tags( $val );
        }
Severity: Minor
Found in includes/abstracts/abstract.llms.post.model.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 init has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function init( $user_data, $plan, $gateway, $coupon = false ) {

        $this->set_user_data( $user_data );

        // Access plan data.
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 record has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

        $err = new WP_Error();

        foreach ( array( 'actor_id', 'object_type', 'object_id', 'event_type', 'event_action' ) as $key ) {
Severity: Minor
Found in includes/class-llms-events.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 unenroll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function unenroll( $product_id, $trigger = 'any', $new_status = 'expired' ) {

        // Can only unenroll those that are a currently enrolled.
        if ( ! $this->is_enrolled( $product_id, 'all', false ) ) {
            return false;
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 set has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function set( $key, $val ) {

        // Don't set the ID.
        if ( 'id' === $key ) {
            return $this;
Severity: Minor
Found in includes/models/model.llms.question.choice.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 store_tracking_events has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function store_tracking_events( $tracking ) {

        $tracking = json_decode( $tracking, true );

        if ( ! empty( $tracking['nonce'] ) && wp_verify_nonce( $tracking['nonce'], 'llms-tracking' ) && get_current_user_id() ) {
Severity: Minor
Found in includes/class-llms-events.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_update_access_plans has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function llms_update_access_plans( $request ) {

        if ( empty( $request['plans'] ) || ! is_array( $request['plans'] ) || empty( $request['post_id'] ) ) {
            return new WP_Error( 'error', __( 'Missing Required Parameters.', 'lifterlms' ) );
        }
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 is_instructor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function is_instructor( $post_id = null ) {

        $ret = false;

        // Use current post if no post is set.
Severity: Minor
Found in includes/models/model.llms.instructor.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_lesson_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

        if ( 'lesson' == $post->post_type ) {
            unset( $GLOBALS['lesson'] );
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 sql_where has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sql_where() {

        global $wpdb;

        $sql = 'WHERE 1';
Severity: Minor
Found in includes/class-llms-events-query.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 set_merge_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_merge_data( $code ) {

        $attempt = new LLMS_Quiz_Attempt( $this->notification->get( 'post_id' ) );
        if ( ! $attempt->exists() ) {
            return '';

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

function llms_sd_my_grades_table_content( $id, $lesson, $student, $restrictions ) {

    ob_start();

    /**
Severity: Minor
Found in includes/functions/llms.functions.templates.dashboard.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 lifterlms_template_student_dashboard_my_grades has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    function lifterlms_template_student_dashboard_my_grades() {

        $student = llms_get_student();
        if ( ! $student ) {
            return;
Severity: Minor
Found in includes/functions/llms.functions.templates.dashboard.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