Showing 140 of 140 total issues
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.
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;
}
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;
}
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ( post_url.indexOf( '?p=' ) > -1 ) {
np_url = post_url + '&alnp=1';
} else {
var partial_endpoint = 'alnp/';
- 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 93.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ( post_url.indexOf( '?p=' ) > -1 ) {
np_url = post_url + '&alnp=1';
} else {
var partial_endpoint = 'alnp/';
- 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 93.
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
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"
Further reading
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
/**
* Auto Load Next Post Theme Support: Make
*
* Applies support for The Theme Foundry Make Theme.
- 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 136.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
/**
* Auto Load Next Post Theme Support: Twenty Ten
*
* Applies support for WordPress Twenty Ten Theme.
- 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 136.
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
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(
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( remove_comments === 'yes' ) {
$( comments_container ).remove();
// Remove Disqus comments if found.
if ( $( '#disqus_thread' ).length > 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 85.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( remove_comments === 'yes' ) {
$( comments_container ).remove();
// Remove Disqus comments if found.
if ( $( '#disqus_thread' ).length > 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 85.
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
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 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
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"