Showing 45 of 379 total issues
Function save_ldp_meta_for_post
has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring. Open
public function save_ldp_meta_for_post( $resource_id ) {
$fields = Utils::get_resource_fields_list( $resource_id );
if ( ! empty( $fields ) ) {
foreach ( $_POST as $key => $value ) {
- Read upRead up
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 271 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.wpldp = function( store, options ) {
this.options = options || {};
this.store = store;
this.resultSet = [];
Function get_resource
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
public function get_resource( \WP_REST_Request $request, \WP_REST_Response $response = null ) {
$params = $request->get_params();
$ldp_container = $params['ldp_container'];
$ldp_resource_slug = $params['ldp_resource'];
- Read upRead up
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
File wp-ldp.php
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* The WP-LDP Plugin main file
* @package WPLDP
* @author Benoit Alessandroni
Function wpldp_plugin_update
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function wpldp_plugin_update() {
$plugin_version = get_option( 'wpldp_version' );
$update_option = null;
if ( self::$version_number !== $plugin_version ) {
- Read upRead up
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 initialize_container
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function initialize_container( $force = false ) {
if ( isset( $_GET['settings-updated'] ) || $force ) {
$ldp_container_init = get_option( 'ldp_container_init', false );
if ( $ldp_container_init || $force ) {
- Read upRead up
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 initialize_container
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initialize_container( $force = false ) {
if ( isset( $_GET['settings-updated'] ) || $force ) {
$ldp_container_init = get_option( 'ldp_container_init', false );
if ( $ldp_container_init || $force ) {
Method get_resource
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_resource( \WP_REST_Request $request, \WP_REST_Response $response = null ) {
$params = $request->get_params();
$ldp_container = $params['ldp_container'];
$ldp_resource_slug = $params['ldp_resource'];
Function get_api_definition
has a Cognitive Complexity of 22 (exceeds 5 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(
- Read upRead up
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_sites_list
has a Cognitive Complexity of 21 (exceeds 5 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(
- Read upRead up
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
File wpldp.js
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
window.wpldp = function( store, options ) {
this.options = options || {};
this.store = store;
this.resultSet = [];
Function format_posts_rendering
has a Cognitive Complexity of 17 (exceeds 5 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] ) ) {
- Read upRead up
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
WpLdp
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class WpLdp {
/**
* The front page url, defaulted as 'wp-ldp/front'.
*/
File class-container-taxonomy.php
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Container
*
* The container taxonomy class and instance.
Method save_ldp_meta_for_post
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save_ldp_meta_for_post( $resource_id ) {
$fields = Utils::get_resource_fields_list( $resource_id );
if ( ! empty( $fields ) ) {
foreach ( $_POST as $key => $value ) {
Method wpldp_plugin_update
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpldp_plugin_update() {
$plugin_version = get_option( 'wpldp_version' );
$update_option = null;
if ( self::$version_number !== $plugin_version ) {
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;
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(
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(
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();