Showing 7 of 154 total issues
Consider simplifying this complex logical expression. Open
Open
if ( $offset > 0 && $offset + mb_strlen( $matches[0], 'UTF-8' ) !== mb_strlen( $title, 'UTF-8' )
&& preg_match( $small_words, $matches[0] ) && ( $offset - 2 < 0 || mb_substr( $title, $offset - 2, 1 , 'UTF-8' ) !== ':' )
&& ( mb_substr( $title, $offset + mb_strlen( $matches[0], 'UTF-8' ), 1 ) !== '-'
|| $offset - 1 < 0 || mb_substr( $title, $offset - 1, 1, 'UTF-8' ) === '-' )
&& ( $offset - 1 < 0 || ! preg_match( '/[^\s-]/', mb_substr( $title, $offset - 1, 1, 'UTF-8' ) ) ) ) {
- Create a ticketCreate a ticket
Method template_redirect_action
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function template_redirect_action() {
global $wpdb;
if ( ! is_404() ) {
return;
- Create a ticketCreate a ticket
Method the_posts_filter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function the_posts_filter( $posts, $wp_query ) {
$file_config = $this->get_config();
if ( false !== $file_config && $wp_query->is_main_query() && ! is_admin() ) {
$default_post = [
'post_author' => 1,
- Create a ticketCreate a ticket
Method add_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function add_config( $file, $rewrite, $template, $prevent_slash = true, $post = [] ) {
- Create a ticketCreate a ticket
Function template_redirect_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function template_redirect_action() {
global $wpdb;
if ( ! is_404() ) {
return;
- Read upRead up
- Create a ticketCreate a ticket
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 _format_time
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function _format_time( $the_time ) {
$time_parts = explode( '|', $the_time );
// Reformat to noon and midnight.
- Read upRead up
- Create a ticketCreate a ticket
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 too many return
statements within this method. Open
Open
return $home_url;
- Create a ticketCreate a ticket