aristath/kirki

View on GitHub

Showing 449 of 644 total issues

Function 40 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"80":80,"83":83,"84":84}],40:[function(_dereq_,module,exports){
var global = _dereq_(46);
var core = _dereq_(30);
var hide = _dereq_(48);
var redefine = _dereq_(94);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function 96 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"25":25}],96:[function(_dereq_,module,exports){
'use strict';

var regexpFlags = _dereq_(44);

Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function 86 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

},{"30":30,"40":40,"42":42}],86:[function(_dereq_,module,exports){
var getKeys = _dereq_(83);
var toIObject = _dereq_(116);
var isEnum = _dereq_(84).f;
module.exports = function (isEntries) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

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 266 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

},{"120":120}],266:[function(_dereq_,module,exports){
'use strict';
var each = _dereq_(20)(0);
var redefine = _dereq_(94);
var meta = _dereq_(70);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

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 getVersionRanges has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getVersionRanges($packageName)
    {
        foreach (self::getInstalled() as $installed) {
            if (!isset($installed['versions'][$packageName])) {
                continue;
Severity: Minor
Found in packages/composer/InstalledVersions.php - About 1 hr to fix

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 get_colors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_colors( $context = 'primary' ) {
        $colors = [
            'primary'     => [ '#ffffff', '#000000', '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107', '#ff9800', '#ff5722', '#795548', '#9e9e9e', '#607d8b' ],
            'red'         => [ '#ffebee', '#ffcdd2', '#ef9a9a', '#e57373', '#ef5350', '#f44336', '#e53935', '#d32f2f', '#c62828', '#b71c1c', '#ff8a80', '#ff5252', '#ff1744', '#d50000' ],
            'pink'        => [ '#fce4ec', '#f8bbd0', '#f48fb1', '#f06292', '#ec407a', '#e91e63', '#d81b60', '#c2185b', '#ad1457', '#880e4f', '#ff80ab', '#ff4081', '#f50057', '#c51162' ],
Severity: Minor
Found in packages/kirki-framework/util/src/MaterialColors.php - About 1 hr to fix

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 process_output has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function process_output( $output, $value ) {
        $output = wp_parse_args(
            $output,
            [
                'element'     => '',
Severity: Minor
Found in packages/kirki-framework/field-dimensions/src/CSS/Dimensions.php - About 1 hr to fix

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 __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct( $config_id = 'global', $args = [] ) {

        // In case the user only provides 1 argument,
        // assume that the provided argument is $args and set $config_id = 'global'.
        if ( is_array( $config_id ) && empty( $args ) ) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/Field.php - About 1 hr to fix

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 start has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  NativeFontWatchRunner.prototype.start = function () {
    var doc = this.domHelper_.getLoadWindow().document,
        that = this;

    var start = goog.now();

Function 210 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"11":11,"16":16,"40":40,"42":42,"46":46}],210:[function(_dereq_,module,exports){
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
var $export = _dereq_(40);
var create = _dereq_(74);
var aFunction = _dereq_(11);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Method getNew has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function getNew( $property = '', $value = '' ) {

            if ( in_array( $property, array( 'red', 'green', 'blue', 'alpha' ), true ) ) {
                // Check if we're changing any of the rgba values.
                $value = max( 0, min( 255, $value ) );
Severity: Minor
Found in lib/class-aricolor.php - About 1 hr to fix

Method download_font_file has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function download_font_file( $url ) {

        $saved_fonts = get_option( 'kirki_font_local_filenames', [] );
        if ( isset( $saved_fonts[ $url ] ) && file_exists( $saved_fonts[ $url ]['file'] ) ) {
            return str_replace(
Severity: Minor
Found in packages/kirki-framework/module-webfonts/src/Webfonts/Helper.php - About 1 hr to fix

Method process_value has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function process_value() {
        $this->value = trim( $this->value );

        // If you use calc() there, I suppose you know what you're doing.
        // No need to process this any further, just exit.

Function processValue has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        processValue: function( output, value ) {
            var self     = this,
                settings = window.parent.wp.customize.get(),
                excluded = false;

Severity: Minor
Found in packages/kirki-framework/module-postmessage/src/postMessage.js - About 1 hr to fix

Function initCropperFrame has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initCropperFrame: function() {

        // We get the field id from which this was called
        var currentFieldId = this.$thisButton.siblings( 'input.hidden-field' ).attr( 'data-field' ),
            attrs          = [ 'width', 'height', 'flex_width', 'flex_height' ], // A list of attributes to look for
Severity: Minor
Found in packages/kirki-framework/control-repeater/src/control.js - About 1 hr to fix

Method enqueue_control_scripts has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function enqueue_control_scripts() {

        wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' );

        wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true );
Severity: Minor
Found in packages/kirki-framework/field-typography/src/Field/Typography.php - About 1 hr to fix

Method set_output has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function set_output() {
        if ( empty( $this->output ) ) {
            return;
        }
        if ( ! is_array( $this->output ) ) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/Field.php - About 1 hr to fix

Method content_template has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function content_template() {
        ?>
        <label class="customize-control-label" for="{{ ! data.choices.id ? 'customize-input-' + data.id : data.choices.id }}">
            <span class="customize-control-title">{{{ data.label }}}</span>
            <# if ( data.description ) { #>
Severity: Minor
Found in packages/kirki-framework/control-generic/src/Control/Generic.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

                if ( 4 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) && isset( $color[3] ) ) {
                    $this->color = 'rgba(' . intval( $color[0] ) . ',' . intval( $color[1] ) . ',' . intval( $color[2] ) . ',' . intval( $color[3] ) . ')';
                    return 'rgba';
                } elseif ( 3 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) ) {
                    // Is this a simple array with 3 items?
Severity: Critical
Found in lib/class-aricolor.php - About 1 hr to fix

Function createRunHook has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createRunHook(hooks, returnFirstArg) {
  /**
   * Runs all callbacks for the specified hook.
   *
   * @param  {string} hookName The name of the hook to run.
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js - About 1 hr to fix
Severity
Category
Status
Source
Language