Showing 194 of 194 total issues
Function initializeSubmenuFocus
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
initializeSubmenuFocus( menu ) {
let parentLinks;
if ( ! menu ) {
return;
Function detect_post_type
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function detect_post_type() {
switch ( true ) {
case is_front_page():
if ( is_home() ) {
return '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 register_widget
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function register_widget( $widget_class_name ) {
global $wp_widget_factory;
if ( ! is_subclass_of( $widget_class_name, 'Super_Awesome_Theme_Widget' ) ) {
if ( is_object( $widget_class_name ) ) {
- 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 register_customize_partial
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function register_customize_partial( $customizer ) {
$partial_colors = array();
if ( ! empty( $this->groups ) ) {
$customizer->add_panel( 'colors', 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 resolve_dependencies
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function resolve_dependencies() {
foreach ( $this->components as $component ) {
foreach ( $this->dependants_map as $class_name => $dependants ) {
if ( $component instanceof $class_name ) {
foreach ( $dependants as $dependant ) {
- 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 print_color_style
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_color_style( $colors ) {
$bottom_bar_text_color = $colors->get( 'bottom_bar_text_color' );
$bottom_bar_background_color = $colors->get( 'bottom_bar_background_color' );
if ( empty( $bottom_bar_text_color ) || empty( $bottom_bar_background_color ) ) {
Method print_color_style
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_color_style( $colors ) {
$top_bar_text_color = $colors->get( 'top_bar_text_color' );
$top_bar_background_color = $colors->get( 'top_bar_background_color' );
if ( empty( $top_bar_text_color ) || empty( $top_bar_background_color ) ) {
Method __construct
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( $id, array $args = array() ) {
$this->id = (string) $id;
$defaults = $this->get_defaults();
foreach ( $defaults as $prop => $default_value ) {
Function current
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
InputData.prototype.current = function (_, callback) {
function getSelected (data, selectedIds) {
var selected = [];
if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
Function selectWoo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.selectWoo = function (options) {
options = options || {};
if (typeof options === 'object') {
this.each(function () {
Function bind
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
StopPropagation.prototype.bind = function (decorated, container, $container) {
decorated.call(this, container, $container);
var stoppedEvents = [
'blur',
Function bind
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
InfiniteScroll.prototype.bind = function (decorated, container, $container) {
var self = this;
decorated.call(this, container, $container);
Function select
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
SelectAdapter.prototype.select = function (data) {
var self = this;
data.selected = true;
Function bind
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
StopPropagation.prototype.bind = function (decorated, container, $container) {
decorated.call(this, container, $container);
var stoppedEvents = [
'blur',
Method register_widget_areas
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_widget_areas( $widgets ) {
$widgets->register_widget_area( new Super_Awesome_Theme_Widget_Area(
'primary',
array(
Super_Awesome_Theme_Widget_Area::PROP_TITLE => __( 'Primary Sidebar', 'super-awesome-theme' ),
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ContainerCSS.prototype.render = function (decorated) {
var $container = decorated.call(this);
var containerCssClass = this.options.get('containerCssClass') || '';
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
DropdownCSS.prototype.render = function (decorated) {
var $dropdown = decorated.call(this);
var dropdownCssClass = this.options.get('dropdownCssClass') || '';
Similar blocks of code found in 2 locations. Consider refactoring. Open
$customizer->add_partial( $post_type->name . '_archive_content', array(
Super_Awesome_Theme_Customize_Partial::PROP_SETTINGS => array( $post_type->name . '_use_excerpt' ),
Super_Awesome_Theme_Customize_Partial::PROP_SELECTOR => '.type-' . $post_type->name . '.archive-view .entry-content',
Super_Awesome_Theme_Customize_Partial::PROP_RENDER_CALLBACK => array( $this, 'partial_entry_content' ),
Super_Awesome_Theme_Customize_Partial::PROP_CONTAINER_INCLUSIVE => true,
- 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 100.
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
$customizer->add_partial( $post_type->name . '_entry_authorbox', array(
Super_Awesome_Theme_Customize_Partial::PROP_SETTINGS => array( $post_type->name . '_show_authorbox' ),
Super_Awesome_Theme_Customize_Partial::PROP_SELECTOR => '.type-' . $post_type->name . ' .entry-authorbox',
Super_Awesome_Theme_Customize_Partial::PROP_RENDER_CALLBACK => array( $this, 'partial_entry_authorbox' ),
Super_Awesome_Theme_Customize_Partial::PROP_CONTAINER_INCLUSIVE => true,
- 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 100.
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 ( ! empty( $entry_attachment_meta_settings ) ) {
$customizer->add_partial( $post_type->name . '_entry_attachment_meta', array(
Super_Awesome_Theme_Customize_Partial::PROP_SETTINGS => $entry_attachment_meta_settings,
Super_Awesome_Theme_Customize_Partial::PROP_SELECTOR => '.type-' . $post_type->name . ' .entry-attachment-meta',
Super_Awesome_Theme_Customize_Partial::PROP_RENDER_CALLBACK => array( $this, 'partial_entry_attachment_meta' ),
- 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 99.
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