assemblee-virtuelle/wp-ldp

View on GitHub

Showing 378 of 379 total issues

Function render has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.render = function render( div, objectIri, template, context, modelName, prefix ) {
        var objectIri = this.store.getIri(objectIri);
        var template = template ? template : this.store.mainTemplate;
        var context = context || this.store.context;
        var fields = modelName ? this.store.models[modelName].fields : null;
Severity: Minor
Found in wpldp.js - About 1 hr to fix

    Method get_api_definition has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function get_api_definition( \WP_REST_Request $request, \WP_REST_Response $response = null ) {
                header( 'Content-Type: application/ld+json' );
                header( 'Access-Control-Allow-Origin: *' );
    
                $query = new \WP_Query(
    Severity: Minor
    Found in class-api.php - About 1 hr to fix

      Method get_sites_list has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function get_sites_list( \WP_REST_Request $request, \WP_REST_Response $response = null ) {
                  header( 'Content-Type: application/ld+json' );
                  header( 'Access-Control-Allow-Origin: *' );
      
                  $terms = get_terms(
      Severity: Minor
      Found in class-site-taxonomy.php - About 1 hr to fix

        Method ldp_enqueue_script has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function ldp_enqueue_script() {
                    global $pagenow, $post_type;
                    $screen = get_current_screen();
                    if ( Wpldp::RESOURCE_POST_TYPE === $post_type ) {
                        wp_enqueue_media();
        Severity: Minor
        Found in wp-ldp.php - About 1 hr to fix

          Method add_custom_tax_fields_onedit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function add_custom_tax_fields_onedit( $term ) {
                      $term_id = $term->term_id;
                      $term_meta = get_option( "ldp_container_$term_id" );
                      $ldp_model = ! empty( $term_meta['ldp_model'] ) ? stripslashes_deep( $term_meta['ldp_model'] ) : '';
                      $ldp_rdf_type = isset( $term_meta['ldp_rdf_type'] ) ? $term_meta['ldp_rdf_type'] : '';
          Severity: Minor
          Found in class-container-taxonomy.php - About 1 hr to fix

            Method wpldpfront_enqueue_script has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public function wpldpfront_enqueue_script() {
                        $current_url = $_SERVER['REQUEST_URI'];
                        if ( strstr( $current_url, Wpldp::FRONT_PAGE_URL ) ) {
                            // Loading the JqueryUI library.
                            wp_register_script(
            Severity: Minor
            Found in wp-ldp.php - About 1 hr to fix

              Function wpldp has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              window.wpldp = function( store, options ) {
              
                  this.options = options || {};
                  this.store   = store;
                  this.resultSet = [];
              Severity: Minor
              Found in wpldp.js - 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

              Function wpldp_db_upgrade has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                      private function wpldp_db_upgrade() {
                          $flush_cache = wp_cache_flush();
                          global $wpdb;
                          $wpdb->query(
                              "UPDATE $wpdb->postmeta
              Severity: Minor
              Found in wp-ldp.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 wpldp_edit_form_advanced has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function wpldp_edit_form_advanced( $post ) {
                          if ( Wpldp::RESOURCE_POST_TYPE === $post->post_type ) {
                              $resource_uri = Utils::get_resource_uri( $post );
              
                              $term = get_the_terms( $post->post_id, 'ldp_container' );
              Severity: Minor
              Found in wp-ldp.php - About 1 hr to fix

                Method get_search_results has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function get_search_results( \WP_REST_Request $request, \WP_REST_Response $response = null ) {
                            header( 'Content-Type: application/ld+json' );
                            header( 'Access-Control-Allow-Origin: *' );
                
                            $params = $request->get_params();
                Severity: Minor
                Found in class-container-taxonomy.php - About 1 hr to fix

                  Method menu_setup has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function menu_setup() {
                              global $submenu;
                              // Removing all resources menu.
                              remove_submenu_page( 'edit.php?post_type=ldp_resource', 'edit.php?post_type=ldp_resource' );
                              $terms = get_terms(
                  Severity: Minor
                  Found in class-settings.php - About 1 hr to fix

                    Method get_resources_from_container has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public function get_resources_from_container( \WP_REST_Request $request, \WP_REST_Response $response = null ) {
                                $params = $request->get_params();
                                $ldp_container = $params['ldp_container'];
                    
                                $headers = $request->get_headers();
                    Severity: Minor
                    Found in class-container-taxonomy.php - About 1 hr to fix

                      Function menu_setup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              function menu_setup() {
                                  global $submenu;
                                  // Removing all resources menu.
                                  remove_submenu_page( 'edit.php?post_type=ldp_resource', 'edit.php?post_type=ldp_resource' );
                                  $terms = get_terms(
                      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

                      Function wpldp_edit_form_advanced has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function wpldp_edit_form_advanced( $post ) {
                                  if ( Wpldp::RESOURCE_POST_TYPE === $post->post_type ) {
                                      $resource_uri = Utils::get_resource_uri( $post );
                      
                                      $term = get_the_terms( $post->post_id, 'ldp_container' );
                      Severity: Minor
                      Found in wp-ldp.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 register_container_taxonomy has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public function register_container_taxonomy() {
                                  $labels = array(
                                      'name'                       => __( 'Containers', 'wpldp' ),
                                      'singular_name'              => __( 'Container', 'wpldp' ),
                                      'menu_name'                  => __( 'Containers', 'wpldp' ),
                      Severity: Minor
                      Found in class-container-taxonomy.php - About 1 hr to fix

                        Method register_site_taxonomy has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                public function register_site_taxonomy() {
                                    $labels = array(
                                        'name'                       => __( 'Sites', 'wpldp' ),
                                        'singular_name'              => __( 'Site', 'wpldp' ),
                                        'menu_name'                  => __( 'Sites', 'wpldp' ),
                        Severity: Minor
                        Found in class-site-taxonomy.php - About 1 hr to fix

                          Method create_ldp_type has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public function create_ldp_type() {
                                      register_post_type( 'ldp_resource',
                                          array(
                                              'labels'  => array(
                                                  'name'               => __( 'Resources', 'wpldp' ),
                          Severity: Minor
                          Found in wp-ldp.php - About 1 hr to fix

                            Function bindEvents has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                this.bindEvents = function() {
                                    var instance = this;
                                    jQuery('.remove-field-button').click( function( event ) {
                                        instance.removeField( event );
                                    });
                            Severity: Minor
                            Found in wpldp.js - About 1 hr to fix

                              Method format_posts_rendering has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      private function format_posts_rendering( $result, $posts ) {
                                          $count = 0;
                                          foreach ( $posts as $post ) {
                                              $values = get_the_terms( $post->ID, 'ldp_container' );
                                              if ( empty( $values[0] ) ) {
                              Severity: Minor
                              Found in class-container-taxonomy.php - About 1 hr to fix

                                Method wpldp_db_upgrade has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        private function wpldp_db_upgrade() {
                                            $flush_cache = wp_cache_flush();
                                            global $wpdb;
                                            $wpdb->query(
                                                "UPDATE $wpdb->postmeta
                                Severity: Minor
                                Found in wp-ldp.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language