gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

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

function maybeRefreshContent( content, editedContent ) {
    const { isSavingPost } = select( editorStore ),
        isSaving = isSavingPost();

    // @see {@link https://github.com/WordPress/gutenberg/issues/17632#issuecomment-583772895}
Severity: Minor
Found in src/js/admin-certificate-editor/editor.js - 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 requiresComposerInstall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function requiresComposerInstall() {
    const
        pkg = getConfig( 'composer' ),
        keys = pkg.require ? Object.keys( pkg.require ) : [],
        autoload = pkg.autoload ? Object.keys( pkg.autoload ) : [];
Severity: Minor
Found in packages/dev/src/utils/create-dist-file.js - 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_cleanup_tmp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function llms_cleanup_tmp() {

    $max_age = llms_current_time( 'timestamp' ) - apply_filters( 'llms_tmpfile_max_age', DAY_IN_SECONDS );

    $exclude = array( '.htaccess', 'index.html' );
Severity: Minor
Found in includes/llms.functions.core.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_make_select2_student_array has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function llms_make_select2_student_array( $user_ids = array(), $template = '' ) {
    if ( ! $template ) {
        $template = '%1$s <%2$s>';
    }
    if ( ! is_array( $user_ids ) ) {
Severity: Minor
Found in includes/llms.functions.core.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 isLinkValid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function isLinkValid( link ) {
    // Force values to a string.
    link = link.toString();

    const isValidHash = ( hash ) => ! isNaN( parseInt( hash.slice( 1 ) ) );
Severity: Minor
Found in packages/dev/src/utils/validate-changelog.js - 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 formatChangelogItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function formatChangelogItem( { entry, type, attributions = [], links = [] }, includeLinks ) {
    entry = entry.trim();

    // Entries should always end in a full stop.
    if ( 'template' !== type && ! [ '.', '?', '!' ].includes( entry.split( '' ).reverse()[ 0 ] ) ) {
Severity: Minor
Found in packages/dev/src/cmds/changelog/write.js - 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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function( wordCount, options ) {
    const { min, max, colorWarning, colorError } = options;

    let color = 'initial';

Severity: Minor
Found in packages/quill-wordcount-module/src/get-counter-text-color.js - 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 updateConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function updateConfig( ver ) {
    const ret = {
        Matches: chalk.yellow( 1 ),
        Replacements: chalk.yellow( 1 ),
    };
Severity: Minor
Found in packages/dev/src/cmds/update-version.js - 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 do_tool has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function do_tool() {

        if ( ! llms_verify_nonce( '_wpnonce', 'llms_tool' ) || ! current_user_can( 'manage_lifterlms' ) ) {
            wp_die( __( 'Action failed. Please refresh the page and retry.', 'lifterlms' ) );
        }
Severity: Minor
Found in includes/admin/class.llms.admin.page.status.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 remove_log_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function remove_log_file() {

        if ( ! llms_verify_nonce( '_wpnonce', 'delete_log', 'GET' ) || ! current_user_can( 'manage_lifterlms' ) ) {
            wp_die( __( 'Action failed. Please refresh the page and retry.', 'lifterlms' ) );
        }
Severity: Minor
Found in includes/admin/class.llms.admin.page.status.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_post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate_post( $post_id, $post ) {

        if ( ! current_user_can( 'edit_post', $post_id ) ) {
            return false;
        } elseif ( empty( $post_id ) || empty( $post ) ) {
Severity: Minor
Found in includes/admin/post-types/class.llms.meta.boxes.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 template_loader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function template_loader( $template ) {

        $page_restricted = llms_page_restricted( get_the_ID() );

        $this->maybe_print_notices_on_sales_page_redirect();
Severity: Minor
Found in includes/class.llms.template.loader.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 is_llms_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function is_llms_page() {

        $screen = get_current_screen();

        $id = str_replace( 'edit-', '', $screen->id );
Severity: Minor
Found in includes/admin/class.llms.admin.assets.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 output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function output() {

        $order = llms_get_post( $this->post );

        if ( llms_parse_bool( $order->get( 'anonymized' ) ) ) {

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

    public function save( $post_id ) {

        if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) {
            return -1;
        }

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

    public function get_fields() {

        $lesson = llms_get_post( $this->post );

        $methods = array(
Severity: Minor
Found in includes/admin/post-types/meta-boxes/class.llms.meta.box.lesson.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_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_fields() {

        $courses     = array();
        $memberships = array();

Severity: Minor
Found in includes/admin/post-types/meta-boxes/class.llms.meta.box.coupon.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_serve_export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_serve_export() {

        $export = llms_filter_input( INPUT_GET, 'llms-dl-export', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
        if ( ! $export ) {
            return;
Severity: Minor
Found in includes/admin/class-llms-admin-export-download.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 submenu_order has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function submenu_order( $flag ) {

        global $submenu;

        if ( isset( $submenu['lifterlms'] ) ) {
Severity: Minor
Found in includes/admin/class.llms.admin.menus.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_staging_notice_actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function handle_staging_notice_actions() {

        if ( ! isset( $_GET['llms-staging-status'] ) || ! isset( $_GET['_llms_staging_nonce'] ) ) {
            return;
        }
Severity: Minor
Found in includes/class-llms-staging.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