gocodebox/lifterlms

View on GitHub

Showing 1,389 of 1,394 total issues

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

function llms_post_classes( $classes, $class = array(), $post_id = '' ) {

    if ( ! $post_id ) {
        return $classes;
    }
Severity: Minor
Found in includes/llms.template.functions.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 parse_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parse_args() {

        $statuses = $this->arguments['statuses'];

        // Allow strings to be submitted when only requesting one status.
Severity: Minor
Found in includes/class.llms.student.query.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_enrollments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_enrollments( $post_type = 'course', $args = array() ) {

        global $wpdb;

        $args = wp_parse_args(
Severity: Minor
Found in includes/models/model.llms.student.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_lesson_options_for_select_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_lesson_options_for_select_list() {

        $lessons = LLMS_Post_Handler::get_posts( 'lesson' );

        $options = array();
Severity: Minor
Found in includes/class.llms.lesson.handler.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 create_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function create_files() {
        $upload_dir = wp_upload_dir();
        $files      = array(
            array(
                'base'    => LLMS_LOG_DIR,
Severity: Minor
Found in includes/class.llms.install.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 validate_selected_gateway has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate_selected_gateway( $gateway_id, $plan ) {

        $gateway = llms()->payment_gateways()->get_gateway_by_id( $gateway_id );
        $err     = new WP_Error();

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

    public function recurring_charge( $order_id ) {

        // Make sure the order still exists.
        $order = llms_get_post( $order_id );
        if ( ! $order || ! is_a( $order, 'LLMS_Order' ) ) {
Severity: Minor
Found in includes/controllers/class.llms.controller.orders.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_lesson_options_for_select_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_lesson_options_for_select_list() {

        $lessons = self::get_posts( 'lesson' );

        $options = array();
Severity: Minor
Found in includes/class.llms.post.handler.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_creation_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_creation_args( $args = null ) {

        // Allow nothing to be passed in.
        if ( empty( $args ) ) {
            $args = array();
Severity: Minor
Found in includes/models/model.llms.question.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 create_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function create_options() {

        $settings = LLMS_Admin_Settings::get_settings_tabs();

        foreach ( $settings as $section ) {
Severity: Minor
Found in includes/class.llms.install.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 delete_enrollment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete_enrollment( $product_id, $trigger = 'any' ) {

        // Assume we can't delete the enrollment.
        $delete = false;

Severity: Minor
Found in includes/models/model.llms.student.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_instructors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_instructors( $exclude_hidden = false ) {

        $instructors = $this->post->get( 'instructors' );

        // If empty, respond with the course author in an array.
Severity: Minor
Found in includes/models/model.llms.post.instructors.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 wizard_redirect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function wizard_redirect() {

        if ( 'yes' === get_option( '_llms_first_time_setup_redirect', 'no' ) ) {

            update_option( '_llms_first_time_setup_redirect', 'no' );
Severity: Minor
Found in includes/class.llms.install.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 restriction_checks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function restriction_checks( $results ) {

        // Only check directories.
        if ( ! bp_is_directory() ) {
            return $results;
Severity: Minor
Found in includes/integrations/class.llms.integration.buddypress.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 enqueue_scripts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function enqueue_scripts() {

        // I don't think we need these next 3 scripts.
        wp_enqueue_script( 'jquery-ui-tooltip' );
        wp_enqueue_script( 'jquery-ui-datepicker' );
Severity: Minor
Found in includes/class.llms.frontend.assets.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 register has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function register() {

        if ( ! llms_verify_nonce( '_llms_register_person_nonce', 'llms_register_person' ) ) {
            return;
        }
Severity: Minor
Found in includes/forms/controllers/class.llms.controller.registration.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_add_required_block_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_add_required_block_fields( $blocks, $location, $args ) {

        $fields_to_require = $this->get_required_fields_for_location( $location, $args );
        if ( empty( $fields_to_require ) ) {
            return $blocks;
Severity: Minor
Found in includes/forms/class-llms-forms-dynamic-fields.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_html_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_html_attributes() {

        $check = array(
            'id',
            'disabled',
Severity: Minor
Found in includes/forms/class-llms-form-field.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 parse_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parse_args() {

        // Sanitize post & user ids.
        foreach ( array( 'actor', 'actor_not_in', 'object', 'object_not_in', 'include', 'exclude' ) as $key ) {
            $this->arguments[ $key ] = $this->sanitize_id_array( $this->arguments[ $key ] );
Severity: Minor
Found in includes/class-llms-events-query.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 create_question has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function create_question( $raw, $manager, $author_id ) {

        /**
         * Filter raw question import data prior to generation
         *
Severity: Minor
Found in includes/class-llms-generator-courses.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