Showing 140 of 140 total issues
Avoid too many return
statements within this method. Open
return __( 'a minute', 'auto-load-next-post' );
Avoid too many return
statements within this method. Open
return sprintf( __( '%s seconds', 'auto-load-next-post' ), $seconds );
Avoid too many return
statements within this method. Open
return sprintf( __( '%s minutes', 'auto-load-next-post' ), $minutes );
Avoid too many return
statements within this method. Open
return sprintf( __( '%s days', 'auto-load-next-post' ), $days );
Identical blocks of code found in 2 locations. Consider refactoring. Open
$( 'body' ).on( 'mousewheel', function( e ) {
scroll_up = e.originalEvent.wheelDelta > 0;
});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid too many return
statements within this method. Open
return __( 'an hour', 'auto-load-next-post' );
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this method. Open
return sprintf( __( '%s hours', 'auto-load-next-post' ), $hours );
Identical blocks of code found in 2 locations. Consider refactoring. Open
$( 'body' ).on( 'mousewheel', function( e ) {
scroll_up = e.originalEvent.wheelDelta > 0;
});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this method. Open
return __( 'a second', 'auto-load-next-post' );
Avoid too many return
statements within this method. Open
return __( 'a day', 'auto-load-next-post' );
Function is_page_alnp_ready
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function is_page_alnp_ready() {
if ( is_front_page() && is_home() ) {
return false;
} elseif ( is_front_page() ) {
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
Function install
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function install() {
if ( ! is_blog_installed() ) {
return;
}
- 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 find_template_location
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function find_template_location() {
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
if ( empty( $post_type ) ) {
wp_send_json( -1 );
- 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 lock_js_in_footer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function lock_js_in_footer( $settings ) {
$js_locked_in_footer = get_option( 'auto_load_next_post_lock_js_in_footer' );
if ( ! empty( $js_locked_in_footer ) && $js_locked_in_footer == 'yes' ) {
// Setting key to look for.
- 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_include_theme_support
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function alnp_include_theme_support() {
$themes_supported = alnp_themes_supported();
if ( is_alnp_active_theme( $themes_supported ) ) {
foreach( $themes_supported as $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 includes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function includes() {
global $wp_version;
include( dirname( __FILE__ ) . '/class-alnp-admin-action-links.php' ); // Action Links
include( dirname( __FILE__ ) . '/class-alnp-admin-assets.php' ); // Admin Assets
- 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 settings_page_init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function settings_page_init() {
global $current_view, $current_section;
// Include settings pages.
include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' );
- 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_get_random_page_permalink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function alnp_get_random_page_permalink( $post_type = 'post' ) {
$args = array(
'post_type' => $post_type,
'post_status' => 'publish',
'orderby' => 'rand',
- 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"