Showing 153 of 194 total issues
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') || '';
Function handle_sticky_elements
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function handle_sticky_elements() {
// Skip for now since it is neither possible to set state nor animate position style based on position observer.
if ( ! $this->is_amp() || true ) {
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 initializeHeaderSiteBranding
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
initializeHeaderSiteBranding() {
const headerSiteBranding = document.querySelector( '.site-custom-header .site-branding' );
const offset = headerSiteBranding ? ( headerSiteBranding.offsetTop ? headerSiteBranding.offsetTop : ( headerSiteBranding.offsetParent ? headerSiteBranding.offsetParent.offsetTop : 0 ) ) : 0;
if ( ! headerSiteBranding ) {
- 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
Avoid deeply nested control flow statements. Open
for (j = baseParts.length; j > 0; j -= 1) {
mapValue = map[baseParts.slice(0, j).join('/')];
//baseName segment has config, find if it has one for
//this name.
Function register_customize_controls_js
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function register_customize_controls_js( $assets ) {
$data = array(
'postTypes' => 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"