assemblee-virtuelle/wp-ldp

View on GitHub

Showing 378 of 379 total issues

Function wpldp_validation_notice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        function wpldp_validation_notice() {
            global $pagenow;
            if ( 'options-general.php' === $pagenow && 'wpldp' === $_GET['page'] ) { // change my-plugin to your plugin page.
                if ( ( isset( $_GET['settings-updated'] ) && 'true' === $_GET['settings-updated'] ) ) {

Severity: Minor
Found in class-settings.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

Method container_meta_box_callback has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function container_meta_box_callback( $post ) {
            wp_nonce_field(
                'wpldp_save_container_box_data',
                'wpldp_container_box_nonce'
            );
Severity: Minor
Found in wp-ldp.php - About 1 hr to fix

    Function ldp_resource_post_link has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function ldp_resource_post_link( $post_link, $id = 0 ) {
                $post = get_post( $id );
    
                if ( Wpldp::RESOURCE_POST_TYPE === get_post_type( $post ) ) {
                    if ( is_object( $post ) ) {
    Severity: Minor
    Found in wp-ldp.php - About 55 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 save_custom_tax_field has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            function save_custom_tax_field( $term_id ) {
                $term_meta = get_option( "ldp_container_$term_id" );
                if ( ! is_array( $term_meta ) ) {
                    $term_meta = array();
                }
    Severity: Minor
    Found in class-container-taxonomy.php - About 45 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

    Avoid deeply nested control flow statements.
    Open

                                                if ( empty( $term ) || ! is_array( $term ) ) {
                                                    $site_url_parsed = wp_parse_url( $site );
                                                    $term = wp_insert_term(
                                                        $site_url_parsed['host'] . ' ' . $site_url_parsed['path'],
                                                        'ldp_site'
    Severity: Major
    Found in wp-ldp.php - About 45 mins to fix

      Function render has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          this.render = function render( div, objectIri, template, context, modelName, prefix ) {
      Severity: Minor
      Found in wpldp.js - About 45 mins to fix

        Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
        Open

                        $term_meta = get_option( "ldp_container_$value->term_id" );
        Severity: Minor
        Found in class-utils.php by phpcodesniffer

        "require_once" is a statement not a function; no parentheses are required
        Open

        require_once( 'class-utils.php' );
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$resource_uri'.
        Open

                                    container: '<?php echo $resource_uri; ?>',
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        Array double arrow not aligned correctly; expected 6 space(s) between "'show_in_menu'" and double arrow, but found 10.
        Open

                            'show_in_menu'          => true,
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        In footer ($in_footer) is not set explicitly wp_register_script; It is recommended to load scripts in the footer. Please set this value to true to load it in the footer, or explicitly false if it should be loaded in the header.
        Open

                        wp_register_script(
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$ldp_model'.
        Open

                                    models: <?php echo $ldp_model; ?>
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        Resource version not set in call to wp_register_script(). This means new versions of the script will not always be loaded due to browser caching.
        Open

                        wp_register_script(
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        Found precision alignment of 2 spaces.
        Open

                                                          strpos( $site, 'https://' ) !== false )
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        Overriding WordPress globals is prohibited. Found assignment to $submenu
        Open

                                $submenu['edit.php?post_type=ldp_resource'][ 10 - $i ] = $submenu_item_value;
        Severity: Minor
        Found in class-settings.php by phpcodesniffer

        Visibility must be declared on method "wpldp_plugin_update"
        Open

                function wpldp_plugin_update() {
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
        Open

                    echo "<th scope='row'><label for='ldp_site_url'>" . __( 'web site', 'wpldp' ). '</label></th>';
        Severity: Minor
        Found in class-site-taxonomy.php by phpcodesniffer

        Resource version not set in call to wp_register_script(). This means new versions of the script will not always be loaded due to browser caching.
        Open

                        wp_register_script(
        Severity: Minor
        Found in wp-ldp.php by phpcodesniffer

        Using cURL functions is highly discouraged. Use wp_remote_get() instead.
        Open

                        curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/ld+json', 'Accept: application/ld+json' ) );
        Severity: Minor
        Found in class-site-taxonomy.php by phpcodesniffer

        Array double arrow not aligned correctly; expected 29 space(s) between "'@type'" and double arrow, but found 4.
        Open

                            '@type'    => 'http://www.w3.org/ns/ldp#BasicContainer',
        Severity: Minor
        Found in class-site-taxonomy.php by phpcodesniffer
        Severity
        Category
        Status
        Source
        Language