Showing 153 of 194 total issues
Method print_base_font_style_general
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_base_font_style_general() {
$base_font = $this->get( 'base_font' );
$heading_font = $this->get( 'heading_font' );
if ( ! empty( $base_font['family_stack'] ) ) {
Method add_field
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function add_field( $id, array $args = array() ) {
if ( ! isset( $args[ self::FIELD_ARG_TYPE ] ) ) {
$args[ self::FIELD_ARG_TYPE ] = self::FIELD_TYPE_TEXT;
}
Function __call
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function __call( $method, $args ) {
switch ( $method ) {
case 'register_settings':
case 'register_customize_partials':
case 'register_customize_controls_js':
- 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 default_sanitize_callback
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function default_sanitize_callback( $value, $args ) {
switch ( $args[ self::FIELD_ARG_TYPE ] ) {
case self::FIELD_TYPE_NUMBER:
if ( isset( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) && is_int( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) ) {
$value = (int) $value;
- 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 Decorate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Utils.Decorate = function (SuperClass, DecoratorClass) {
var decoratedMethods = getMethods(DecoratorClass);
var superMethods = getMethods(SuperClass);
function DecoratedClass () {
Method render_comment
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render_comment( $comment = null, $args = array(), $depth = 0, $close = false ) {
$reset_global_comment = false;
if ( ! isset( $GLOBALS['comment'] ) ) {
if ( null === $comment ) {
Function checkStickyContainers
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkStickyContainers() {
const pageWrap = this.pageWrap;
const topOffsets = this.stickToTopOffsets;
const bottomOffsets = this.stickToBottomOffsets;
Method register_main_assets
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function register_main_assets() {
$this->register_asset( new Super_Awesome_Theme_Script(
'wp-i18n',
get_theme_file_uri( '/assets/dist/js/wp-i18n.js' ),
array(
Function addRemoveStickyContainer
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
addRemoveStickyContainer( selector, location, remove ) {
const container = document.querySelector( selector );
let selectorsHandle, containersHandle, offsetsHandle, exists;
if ( 'top' === location ) {
selectorsHandle = 'stickToTopSelectors';
Method default_sanitize_callback
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function default_sanitize_callback( $value, $args ) {
switch ( $args[ self::FIELD_ARG_TYPE ] ) {
case self::FIELD_TYPE_NUMBER:
if ( isset( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) && is_int( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) ) {
$value = (int) $value;
Method register_customize_partial
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_customize_partial( $customizer ) {
$partial_colors = array();
if ( ! empty( $this->groups ) ) {
$customizer->add_panel( 'colors', array(
Function ready
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ready: function() {
const value = this.setting.get();
const $familySelect = this.container.find( '[data-setting-property="family"]' );
const $weightSelect = this.container.find( '[data-setting-property="weight"]' );
const $sizeInput = this.container.find( '[data-setting-property="size"]' );
Function handle_ajax_comment
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function handle_ajax_comment( $id, $status ) {
if ( empty( $_GET['is_ajax'] ) || 'true' !== $_GET['is_ajax'] ) {
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 bind
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
SingleSelection.prototype.bind = function (container, $container) {
var self = this;
SingleSelection.__super__.bind.apply(this, arguments);
Method __construct
has 34 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 ) {
Method __call
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __call( $method, $args ) {
switch ( $method ) {
case 'ensure_inline_widgets_whitelist':
case 'register_customize_controls':
case 'register_customize_controls_js':
Function wrapper
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wrapper (obj, child) {
var data = obj.results;
for (var i = 0; i < data.length; i++) {
var option = data[i];
Method render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function render( array $instance ) {
$login_url = '';
$login_label = '';
$register_url = '';
$register_label = '';
Function handleSubmission
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleSubmission( e ) {
const formUrl = commentForm.getAttribute( 'action' ) + ( commentForm.getAttribute( 'action' ).indexOf( '?' ) > -1 ? '&' : '?' ) + 'is_ajax=true';
const fields = commentForm.querySelectorAll( 'input, textarea' );
let hasError = false;
Method register_settings
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_settings() {
$settings = $this->get_dependency( 'settings' );
$this->attachment_metadata = new Super_Awesome_Theme_Attachment_Metadata( $settings );
$boolean_settings = array();