assemblee-virtuelle/wp-ldp

View on GitHub

Showing 45 of 379 total issues

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

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

              public static function get_resource_fields_list( $resource_id ) {
                  $value = null;
                  $fields = array();
                  $values = get_the_terms( $resource_id, 'ldp_container' );
                  if ( ! empty( $values ) && ! is_wp_error( $values ) ) {
      Severity: Minor
      Found in class-utils.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 generate_menu_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public static function generate_menu_item() {
                  $menu_name = 'primary';
                  $locations = get_nav_menu_locations();
      
                  if ( ! empty( $locations ) && isset( $locations[ $menu_name ] ) ) {
      Severity: Minor
      Found in wp-ldp.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