assemblee-virtuelle/wp-ldp

View on GitHub

Showing 45 of 379 total issues

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_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

      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

      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 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 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 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

              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

              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 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 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

                          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

                            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
                              Severity
                              Category
                              Status
                              Source
                              Language