Showing 88 of 140 total issues
Method add_debug_info
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_debug_info( $debug_info ) {
$debug_info['auto-load-next-post'] = array(
'label' => esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ),
'fields' => array(
// Theme Selectors
File scanner.js
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global alnp_scanner_params */
( function( $, params ) {
var step = '',
search_finished = true,
Method get_settings
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_settings() {
return apply_filters(
'alnp_misc_settings', array(
'title' => array(
Function search_elements
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function search_elements( action ) {
$.ajax({
method: "GET",
url: request_url + '?action=' + action,
dataType: 'json',
Function alnp_init_customizer
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function alnp_init_customizer( $wp_customize ) {
/**
* Dont add settings to the customizer if the user does
* not have permission to make changes to the theme.
*/
- 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 auto_load_next_post_seconds_to_words
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function auto_load_next_post_seconds_to_words( $seconds ) {
// Get the years.
$years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100;
if ( $years > 1 ) {
/* translators: Number of years */
- 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 admin_scripts
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function admin_scripts() {
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
if ( $screen_id == 'settings_page_auto-load-next-post' ) {
Function success
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function( data ) {
$(data).each( function( index, selector ) {
var element = $(post).find(selector);
// Check if element was found in post.
Function auto_load_next_post
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function auto_load_next_post() {
// If the user can not read any more then stop looking for new posts.
if ( stop_reading ) {
return;
}
Method alnp_init_customizer
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alnp_init_customizer( $wp_customize ) {
/**
* Dont add settings to the customizer if the user does
* not have permission to make changes to the theme.
*/
Function get_settings
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function get_settings() {
$settings = array();
$description = sprintf( __( 'This helps fine tune %s to locate your theme templates directory in order to display content in the same style as your theme.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
- 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 update_alnp_theme_selectors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function update_alnp_theme_selectors( $stylesheet = '', $old_theme = false ) {
// Check if Auto Load Next Post is supported before updating the theme selectors.
if ( is_alnp_supported() ) {
$theme_support = get_theme_support( 'auto-load-next-post' );
- 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 get_settings
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_settings() {
$settings = array();
$description = sprintf( __( 'This helps fine tune %s to locate your theme templates directory in order to display content in the same style as your theme.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
Method output
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output( $current_view ) {
if ( $current_view !== 'getting-started' ) {
return;
}
Function checkPendingRequest
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkPendingRequest() {
if ( $.active > 0 ) {
window.setTimeout(checkPendingRequest, 8000);
}
else {
Function get_settings
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function get_settings() {
global $blog_id;
$settings = array();
- 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 alnp_template_redirect
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function alnp_template_redirect() {
global $wp_query;
// If this is not a request for alnp or a singular object then bail.
if ( ! isset( $wp_query->query_vars['alnp'] ) || ! is_singular() ) {
- 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 set_theme_selectors
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function set_theme_selectors() {
if ( is_alnp_supported() ) {
$content_container = alnp_get_theme_support( 'content_container' );
$title_selector = alnp_get_theme_support( 'title_selector' );
$navigation_container = alnp_get_theme_support( 'navigation_container' );
- 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 alnp_find_template
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function alnp_find_template( $location = '', $post_type, $post_format ) {
// Templates to look for based on the post that is loaded.
$templates = alnp_get_templates( $post_type, $post_format );
$found = false;
- 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 load_file
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false ) {
$url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file.
if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) {
if ( $is_script ) {
- 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"