Showing 41 of 44 total issues
File helpers.php
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Timeline Express Helper Functions
* By Code Parrots
*
File class-timeline-express-admin.php
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Timeline Express :: Admin Class
*
* @author Code Parrots
Similar blocks of code found in 2 locations. Consider refactoring. Open
<g opacity="0.2">
<g>
<defs>
<rect id="SVGID_5_" x="10.063" y="20.902" width="4.905" height="0.77"/>
</defs>
- 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 135.
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
<g opacity="0.2">
<g>
<defs>
<rect id="SVGID_7_" x="7.751" y="1.031" width="6.281" height="20.162"/>
</defs>
- 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 135.
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
File page.addons.php
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Addon Template - Admin Page
*
* @package Timeline Express
Method timeline_express_add_on_activation
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function timeline_express_add_on_activation() {
if ( ! current_user_can( 'install_plugins' ) ) {
wp_die( __( 'Sorry, you are not allowed to activate plugins on this site.', 'timeline-express' ) );
Timeline_Express_Admin
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Timeline_Express_Admin {
/**
* Main constructor
*/
public function __construct() {
Method timeline_express_addon_details
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function timeline_express_addon_details( $data ) {
?>
<div class="plugin-card-bottom">
Method timeline_express_render_addon
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function timeline_express_render_addon( $addon, $free = false ) {
/**
* Allowed tags for the byline - borrowed from WordPress core.
*
Method timeline_express_build_bootstrap_icon_dropdown
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function timeline_express_build_bootstrap_icon_dropdown( $field, $meta ) {
$screen = get_current_screen();
$screen_base = $screen->base;
Identical blocks of code found in 2 locations. Consider refactoring. Open
$api = plugins_api(
'plugin_information',
array(
'slug' => $plugin,
'fields' => array(
- 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 125.
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
$api = plugins_api(
'plugin_information',
array(
'slug' => $plugin,
'fields' => array(
- 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 125.
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 edit
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
edit: props => {
const { attributes: { announcementLimit, displayOrder, timeFrame }, className, setAttributes } = props;
return [
Method timeline_express_add_on_installer
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function timeline_express_add_on_installer() {
if ( ! current_user_can( 'install_plugins' ) ) {
wp_die( __( 'Sorry, you are not allowed to install plugins on this site.', 'timeline-express' ) );
Method timeline_express_get_announcement_image
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function timeline_express_get_announcement_image( $post_id, $image_size = 'timeline-express' ) {
if ( ! get_post_meta( $post_id, 'announcement_image_id', true ) && ! get_post_meta( $post_id, 'announcement_image', true ) ) {
return;
Method timeline_express_build_addon_data
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function timeline_express_build_addon_data( $data, $free = false ) {
$all_plugins = get_plugins();
$slug = isset( $data['slug'] ) ? $data['slug'] : sanitize_title( $data['name'] . ' Add-On' );
Method timeline_express_print_inline_styles
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function timeline_express_print_inline_styles( $timeline_express_options ) {
$content_background = ( '' === $timeline_express_options['announcement-bg-color'] ) ? 'transparent' : $timeline_express_options['announcement-bg-color'];
$content_shadow = ( '' === $timeline_express_options['announcement-box-shadow-color'] ) ? '0 3px 0 transparent' : '0 3px 0 ' . $timeline_express_options['announcement-box-shadow-color'];
Method generate_timeline_express
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate_timeline_express( $timeline_express_options, $atts ) {
ob_start();
global $post;
Method timeline_express_get_announcement_icon_markup
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function timeline_express_get_announcement_icon_markup( $post_id, $link = true ) {
$timeline_express_options = timeline_express_get_options();
$custom_icon_html = apply_filters( 'timeline_express_custom_icon_html', apply_filters( 'timeline-express-custom-icon-html', false, $post_id, $timeline_express_options ), $post_id, $timeline_express_options );
Function timeline_express_build_bootstrap_icon_dropdown
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function timeline_express_build_bootstrap_icon_dropdown( $field, $meta ) {
$screen = get_current_screen();
$screen_base = $screen->base;
- 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"