gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

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

    private static function get_template_blocks( $location, $reusable ) {

        $blocks = array();

        // Email and password are added in different locations depending on the form.
Severity: Minor
Found in includes/forms/class-llms-form-templates.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_current_tab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_current_tab( $return = 'data' ) {

        global $wp;

        // Set default tab.
Severity: Minor
Found in includes/class.llms.student.dashboard.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_tabs_for_nav has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_tabs_for_nav() {

        $tabs = array();

        foreach ( self::get_tabs() as $var => $data ) {
Severity: Minor
Found in includes/class.llms.student.dashboard.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_order_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function get_order_data( $order ) {

        $data = array();

        $props = self::get_order_data_props( 'export' );
Severity: Minor
Found in includes/privacy/class-llms-privacy-exporters.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 prepare_options_from_preset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepare_options_from_preset() {

        $preset_id = $this->settings['options_preset'];
        switch ( $preset_id ) {
            case 'countries':
Severity: Minor
Found in includes/forms/class-llms-form-field.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 can_process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function can_process( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {

        /**
         * Skip engagement processing checks and force engagements to process.
         *
Severity: Minor
Found in includes/class-llms-engagement-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_field_blocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_field_blocks( $blocks ) {

        $fields = array();

        foreach ( $blocks as $block ) {
Severity: Minor
Found in includes/forms/class-llms-forms.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 register_post_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function register_post_type( $name, $data ) {

        if ( ! post_type_exists( $name ) ) {

            $unprefixed_name = str_replace( 'llms_', '', $name );
Severity: Minor
Found in includes/class.llms.post-types.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 handle_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function handle_email( $args ) {

        $can_process = self::can_process( 'email', ...$args );
        if ( true !== $can_process ) {
            return $can_process;
Severity: Minor
Found in includes/class-llms-engagement-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 set_merge_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_merge_data( $code ) {

        switch ( $code ) {

            case '{{DASHBOARD_URL}}':

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

    function llms_agree_to_terms_form_field( $echo = true ) {

        // Because `do_action()` passes empty string.
        if ( '' === $echo ) {
            $echo = true;
Severity: Minor
Found in includes/functions/llms.functions.templates.privacy.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 memberships has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function memberships( $atts ) {

        // Enqueue match height so the loop isn't all messed up visually.
        self::enqueue_script( 'llms-jquery-matchheight' );

Severity: Minor
Found in includes/shortcodes/class.llms.shortcodes.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_is_post_restricted_by_drip_settings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function llms_is_post_restricted_by_drip_settings( $post_id, $user_id = null ) {

    $post_type = get_post_type( $post_id );

    switch ( $post_type ) {
Severity: Minor
Found in includes/functions/llms.functions.access.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_privacy_policy_form_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_privacy_policy_form_field( $echo = true ) {

        // Because `do_action()` passes empty string.
        if ( '' === $echo ) {
            $echo = true;
Severity: Minor
Found in includes/functions/llms.functions.templates.privacy.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_get_callable_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function llms_get_callable_name( $callable ) {

    // Function name or static class -> method: 'function' or 'class::method'.
    if ( is_string( $callable ) ) {
        return $callable;
Severity: Minor
Found in includes/functions/llms.functions.log.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_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_output() {

        $this->enqueue_script( 'llms-jquery-matchheight' );

        ob_start();
Severity: Minor
Found in includes/shortcodes/class.llms.shortcode.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 unset_relationships has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function unset_relationships( $post, $data ) {

        $relationships = $this->get_related_posts( $post->ID, $data['post_type'], $data['meta_key'] );

        foreach ( $relationships as $id ) {
Severity: Minor
Found in includes/class.llms.post.relationships.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_is_post_restricted_by_time_period has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function llms_is_post_restricted_by_time_period( $post_id, $user_id = null ) {

    $post_type = get_post_type( $post_id );

    switch ( $post_type ) {
Severity: Minor
Found in includes/functions/llms.functions.access.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 migrate_award_templates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function migrate_award_templates() {

    $per_page = llms_update_util_get_items_per_page();

    $query = new \WP_Query(
Severity: Minor
Found in includes/functions/updates/llms-functions-updates-600.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 action_callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function action_callback( $order_id = null, $type = null ) {

        // Make sure order_id and type have been provided.
        if ( ! $order_id || ! $type ) {
            return 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

Severity
Category
Status
Source
Language