aristath/kirki

View on GitHub

Showing 449 of 644 total issues

Function maybe_change_settings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function maybe_change_settings( $args ) {
        // Check if we have an option-name defined.
        if ( isset( $args['option_name'] ) ) {
            if ( isset( $args['settings'] ) && $args['settings'] && false !== strpos( $args['settings'], $args['option_name'] . '[' ) ) {
                return $args;
Severity: Minor
Found in packages/kirki-framework/data-option/src/Option.php - About 55 mins 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_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function process_value() {
        if ( is_array( $this->value ) && isset( $this->value['url'] ) ) {
            $this->value = $this->value['url'];
        }
        if ( false === strpos( $this->value, 'gradient' ) && false === strpos( $this->value, 'url(' ) ) {

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 exports has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 50 mins to fix

Function FontWatchRunner has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

webfont.FontWatchRunner = function(activeCallback, inactiveCallback, domHelper,
    font, opt_timeout, opt_metricCompatibleFonts, opt_fontTestString) {

Method add_setting has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    final function add_setting( $classname, $setting, $default, $type, $capability, $transport, $sanitize_callback ) {
Severity: Major
Found in packages/kirki-framework/compatibility/src/Settings.php - About 50 mins to fix

Function exports has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins to fix

Function set has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function set(view, bytes, index, conversion, value, isLittleEndian) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                                if ( 'background-color' === output.property ) {
                                    processedValue = 'unset';
                                } else if ( 'background-image' === output.property ) {
                                    processedValue = 'none';
                                }
Severity: Major
Found in packages/kirki-framework/module-postmessage/src/postMessage.js - About 45 mins to fix

Function 241 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

},{"107":107}],241:[function(_dereq_,module,exports){
var $export = _dereq_(40);
var toAbsoluteIndex = _dereq_(113);
var fromCharCode = String.fromCharCode;
var $fromCodePoint = String.fromCodePoint;
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins 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 mustBeCropped has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    mustBeCropped: function( flexW, flexH, dstW, dstH, imgW, imgH ) {
Severity: Minor
Found in packages/kirki-framework/control-repeater/src/control.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if ( ! _.isUndefined( control.params.fields[ this.label.field ].type ) ) {
                            if ( 'select' === control.params.fields[ this.label.field ].type ) {
                                if ( ! _.isUndefined( control.params.fields[ this.label.field ].choices ) && ! _.isUndefined( control.params.fields[ this.label.field ].choices[ rowLabelField.val() ] ) ) {
                                    rowLabel = control.params.fields[ this.label.field ].choices[ rowLabelField.val() ];
                                }
Severity: Major
Found in packages/kirki-framework/control-repeater/src/control.js - About 45 mins to fix

Function 119 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

},{"35":35}],119:[function(_dereq_,module,exports){
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = _dereq_(57);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins 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 18 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

},{"113":113,"117":117,"118":118}],18:[function(_dereq_,module,exports){
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
'use strict';
var toObject = _dereq_(118);
var toAbsoluteIndex = _dereq_(113);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins 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 168 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

},{"40":40,"67":67}],168:[function(_dereq_,module,exports){
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
var $export = _dereq_(40);
var abs = Math.abs;

Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                                    if ( 'background-color' === property ) {
                                        processedValue = 'unset';
                                    } else if ( 'background-image' === property ) {
                                        processedValue = 'none';
                                    }
Severity: Major
Found in packages/kirki-framework/module-postmessage/src/postMessage.js - About 45 mins to fix

Function 108 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

},{"35":35,"40":40,"42":42}],108:[function(_dereq_,module,exports){
// https://github.com/tc39/proposal-string-pad-start-end
var toLength = _dereq_(117);
var repeat = _dereq_(109);
var defined = _dereq_(35);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins 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 109 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

},{"109":109,"117":117,"35":35}],109:[function(_dereq_,module,exports){
'use strict';
var toInteger = _dereq_(115);
var defined = _dereq_(35);

Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins 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 showKirkiControl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    showKirkiControl: function( control ) {
        var self     = this,
            show     = true,
            isOption = (
                control.params && // Check if control.params exists.
Severity: Minor
Found in packages/kirki-framework/module-field-dependencies/src/script.js - About 45 mins 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 getSubstitution has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (byteLength < 0) throw RangeError(WRONG_LENGTH);
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 45 mins to fix
Severity
Category
Status
Source
Language