Showing 88 of 140 total issues
Function output_fields
has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring. Open
public static function output_fields( $options ) {
foreach ( $options as $key => $value ) {
if ( ! isset( $value['type'] ) ) {
continue;
- 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 exports
has 315 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
'use strict';
var sass = require( 'node-sass' );
Method output_fields
has 269 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output_fields( $options ) {
foreach ( $options as $key => $value ) {
if ( ! isset( $value['type'] ) ) {
continue;
Function save_fields
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
public static function save_fields( $options ) {
if ( empty( $_POST ) ) {
return 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
File class-alnp-admin-settings.php
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Auto Load Next Post - Admin Settings Class.
*
* @since 1.0.0
Method get_settings
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_settings() {
global $blog_id;
$settings = array();
Method output
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output( $current_view ) {
if ( $current_view !== 'setup-wizard' ) {
return;
}
Function run_alnp
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run_alnp() {
if ( $( 'article' ).length <= 0 ) {
console.log( 'HTML5 semantics for article has not been found. Setting compatible HTML semantic.' );
article_container = 'div';
}
File class-alnp-customizer.php
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Auto Load Next Post: Theme Customizer
*
* @since 1.5.0
Method add_help_tabs
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_help_tabs() {
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
if ( $screen_id != 'settings_page_auto-load-next-post' ) {
Function alnp_get_theme_support
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function alnp_get_theme_support( $prop = '', $default = null ) {
$theme_support = get_theme_support( 'auto-load-next-post' );
$theme_support = is_array( $theme_support ) ? $theme_support[0] : false;
if ( ! $theme_support ) {
- 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 Gruntfile.js
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
module.exports = function(grunt) {
'use strict';
var sass = require( 'node-sass' );
Function add_notices
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function add_notices() {
global $current_user;
// If the current user can not install plugins then return nothing!
if ( ! current_user_can( 'install_plugins' ) ) {
- 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 alnp_get_customizer_controls
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alnp_get_customizer_controls() {
/**
* Filter Customizer controls for Auto Load Next Post.
*
* @param array $controls Customizer controls to add.
Method alnp_get_customizer_settings
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alnp_get_customizer_settings() {
$settings = $this->alnp_get_settings();
/**
* Filter Customizer settings for Auto Load Next Post.
Method save_fields
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function save_fields( $options ) {
if ( empty( $_POST ) ) {
return false;
}
Function auto_load_next_post
has 80 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;
}
Function run_alnp
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run_alnp() {
if ( $( 'article' ).length <= 0 ) {
article_container = 'div';
}
File auto-load-next-post.dev.js
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Variables
var version = auto_load_next_post_params.alnp_version,
content_container = auto_load_next_post_params.alnp_content_container,
post_title_selector = auto_load_next_post_params.alnp_title_selector,
nav_container = auto_load_next_post_params.alnp_navigation_container,
Function alnp_scan_directories
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function alnp_scan_directories( $post_type = 'post', $post_format = '' ) {
// Possible locations where the content files are found.
$locations = alnp_get_locations();
// Templates to look for based on the post that is loaded.
- 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"