Showing 153 of 194 total issues
Function item
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SelectAdapter.prototype.item = function ($option) {
var data = {};
data = $.data($option[0], 'data');
Method print_base_color_style_footer
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function print_base_color_style_footer() {
$footer_text_color = $this->get( 'footer_text_color' );
$footer_link_color = $this->get( 'footer_link_color' );
$footer_link_focus_color = $this->util()->darken_color( $footer_link_color, 25 );
$footer_background_color = $this->get( 'footer_background_color' );
Function render_comment
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function render_comment( $comment = null, $args = array(), $depth = 0, $close = false ) {
$reset_global_comment = false;
if ( ! isset( $GLOBALS['comment'] ) ) {
if ( null === $comment ) {
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function print_color_style( $colors ) {
$navbar_text_color = $colors->get( 'navbar_text_color' );
$navbar_background_color = $colors->get( 'navbar_background_color' );
if ( empty( $navbar_text_color ) || empty( $navbar_background_color ) ) {
Method print_base_color_style_header
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function print_base_color_style_header() {
$header_text_color = $this->get( 'header_textcolor' );
$header_link_color = $this->get( 'header_link_color' );
$header_link_focus_color = $this->util()->darken_color( $header_link_color, 25 );
$header_background_color = $this->get( 'header_background_color' );
Function _resolveWidth
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Select2.prototype._resolveWidth = function ($element, method) {
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
if (method == 'resolve') {
var styleWidth = this._resolveWidth($element, 'style');
Function bind
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MultipleSelection.prototype.bind = function (container, $container) {
var self = this;
MultipleSelection.__super__.bind.apply(this, arguments);
Function tokenizer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
var separators = options.get('tokenSeparators') || [];
var term = params.term;
var i = 0;
Method detect_post_type
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function detect_post_type() {
switch ( true ) {
case is_front_page():
if ( is_home() ) {
return 'post';
Method get_svg
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_svg( $icon, array $args = array() ) {
$this->needs_svg = true;
$args = wp_parse_args( $args, array(
'title' => '',
Function destroy
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Select2.prototype.destroy = function () {
this.$container.remove();
if (this.$element[0].detachEvent) {
this.$element[0].detachEvent('onpropertychange', this._syncA);
Method register_base_colors_general
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function register_base_colors_general() {
$this->register_group( 'general_colors', __( 'General Colors', 'super-awesome-theme' ) );
$this->register_color( new Super_Awesome_Theme_Color( 'text_color', array(
Super_Awesome_Theme_Color::PROP_GROUP => 'general_colors',
Function query
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tokenizer.prototype.query = function (decorated, params, callback) {
var self = this;
function createAndSelect (data) {
// Normalize the data object so we can use it for checks
Method get_fonts_url
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function get_fonts_url( array $fonts ) {
$font_families = array();
foreach ( $fonts as $font ) {
if ( ! $font['family'] instanceof Super_Awesome_Theme_Webfont_Family ) {
Function convertToOptions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ArrayAdapter.prototype.convertToOptions = function (data) {
var self = this;
var $existing = this.$element.find('option');
var existingIds = $existing.map(function () {
Method register_customize_controls_js
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function register_customize_controls_js( $assets ) {
$data = array(
'groups' => array(),
'colors' => array(),
'footerWidgetAreas' => super_awesome_theme( 'footer_widget_areas' )->get_widget_area_names(),
Function option
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SelectAdapter.prototype.option = function (data) {
var option;
if (data.children) {
option = document.createElement('optgroup');
Method content_template
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function content_template() {
?>
<# var defaultValue = '#RRGGBB', defaultValueAttr = '',
isHueSlider = data.mode === 'hue';
if ( data.defaultValue && _.isString( data.defaultValue ) && ! isHueSlider ) {
Function _syncSubtree
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Select2.prototype._syncSubtree = function (evt, mutations) {
var changed = false;
var self = this;
// Ignore any mutation events raised for elements that aren't options or
Function initializeSubmenuFocus
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initializeSubmenuFocus( menu ) {
let parentLinks;
if ( ! menu ) {
return;