gocodebox/lifterlms

View on GitHub

Showing 1,389 of 1,394 total issues

Function save_user_meta_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function save_user_meta_fields( $user_id ) {

        if ( ! $this->current_user_can_edit_admin_custom_fields() ) {
            return;
        }
Severity: Minor
Found in includes/admin/class-llms-admin-profile.php - About 35 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_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_fields() {

        global $post;

        $course = new LLMS_Course( $this->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 llms_merge_code_button has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function llms_merge_code_button( $target = 'content', $echo = true, $codes = array() ) {

    $screen = get_current_screen();

    if ( ! $codes && $screen && isset( $screen->post_type ) ) {
Severity: Minor
Found in includes/admin/llms.functions.admin.php - About 35 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_products_for_cat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function get_products_for_cat( $cat, $include_bundles = true ) {

        $products = array();

        foreach ( $this->data['items'] as $item ) {
Severity: Minor
Found in includes/admin/class.llms.admin.addons.php - About 35 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 handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handle() {

        $orders = array();

        foreach ( $this->get_orders() as $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 handle_reusable_blocks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handle_reusable_blocks( $post, $raw ) {

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

    public function get_price( $key, $price_args = array(), $format = 'html' ) {

        $price = $this->get( $key );

        // Handle empty or unset values gracefully.
Severity: Minor
Found in includes/abstracts/abstract.llms.post.model.php - About 35 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_link has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_link( $context = 'course' ) {

        $url = '';

        switch ( $this->get( 'meta_key' ) ) {
Severity: Minor
Found in includes/models/model.llms.user.postmeta.php - About 35 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_filters_html has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_table_filters_html() {
        ob_start();
        ?>
        <div class="llms-table-filters">
            <?php foreach ( $this->get_columns() as $id => $data ) : ?>
Severity: Minor
Found in includes/abstracts/abstract.llms.admin.table.php - About 35 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 is_on_sale has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function is_on_sale() {

        $ret = false;

        if ( llms_parse_bool( $this->get( 'on_sale' ) ) ) {
Severity: Minor
Found in includes/models/model.llms.access.plan.php - About 35 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 toArrayAfter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function toArrayAfter( $arr ) {

        $arr['questions'] = array();

        // Builder lazy loads questions via ajax.
Severity: Minor
Found in includes/models/model.llms.quiz.php - About 35 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct() {

        if ( ! defined( 'LLMS_BG_UPDATE_LOG' ) ) {
            define( 'LLMS_BG_UPDATE_LOG', true );
        }
Severity: Minor
Found in includes/abstracts/abstract.llms.update.php - About 35 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 query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function query() {

        global $wpdb;

        // Roughly avoid warnings on using wpdb::prepare without placeholders.
Severity: Minor
Found in includes/abstracts/abstract.llms.analytics.widget.php - About 35 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 to_array_extra_blocks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function to_array_extra_blocks( $content ) {

        $blocks = array();

        foreach ( parse_blocks( $content ) as $block ) {
Severity: Minor
Found in includes/abstracts/abstract.llms.post.model.php - About 35 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_schedule_payment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_schedule_payment( $recalc = true ) {

        if ( ! $this->is_recurring() ) {
            return;
        }
Severity: Minor
Found in includes/models/model.llms.order.php - About 35 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_redirection_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function calculate_redirection_url( $redirect_type ) {

        $available = $this->is_available_to_user( get_current_user_id() );

        if ( ! $available && 'no' === $this->get( 'checkout_redirect_forced' ) ) {
Severity: Minor
Found in includes/models/model.llms.access.plan.php - About 35 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 is_available_to_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function is_available_to_user( $user_id = null ) {

        $user_id = empty( $user_id ) ? get_current_user_id() : $user_id;

        $access = true;
Severity: Minor
Found in includes/models/model.llms.access.plan.php - About 35 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_merged_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function get_merged_string( $string ) {

        // Only merge if there are codes in the string.
        if ( false !== strpos( $string, '{{' ) ) {

Severity: Minor
Found in includes/abstracts/llms.abstract.notification.view.php - About 35 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 prepare_event has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepare_event( $raw_event = array() ) {

        if ( ! isset( $raw_event['event'] ) ) {
            // Translators: %s = Event field key.
            return new WP_Error( 'llms_events_missing_event', sprintf( __( 'The event is missing the "%s" field.', 'lifterlms' ), 'event' ) );
Severity: Minor
Found in includes/class-llms-events.php - About 35 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 sql_where has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sql_where() {

        global $wpdb;

        $sql = 'WHERE 1';
Severity: Minor
Found in includes/class.llms.query.quiz.attempt.php - About 35 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