aristath/kirki

View on GitHub

Showing 644 of 644 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

},{"57":57,"70":70,"85":85}],203:[function(_dereq_,module,exports){
// 19.1.2.17 Object.seal(O)
var isObject = _dereq_(57);
var meta = _dereq_(70).onFreeze;

packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4188..4199
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4273..4284

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 114.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function 45 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

},{"16":16}],45:[function(_dereq_,module,exports){
var ctx = _dereq_(32);
var call = _dereq_(59);
var isArrayIter = _dereq_(54);
var anObject = _dereq_(16);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 3 hrs 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 137 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

},{"104":104,"20":20,"40":40}],137:[function(_dereq_,module,exports){
'use strict';
var ctx = _dereq_(32);
var $export = _dereq_(40);
var toObject = _dereq_(118);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 3 hrs 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

Method init has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function init( $args = [] ) {

        self::$typography_controls[] = $args['settings'];

        self::$std_variants = [
Severity: Major
Found in packages/kirki-framework/field-typography/src/Field/Typography.php - About 3 hrs to fix

Function initKirkiControl has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initKirkiControl: function( control ) {
        var value, saveAs, preview, previewImage, removeButton, defaultButton;
        control       = control || this;
        value         = control.setting._value;
        saveAs        = ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.save_as ) ) ? control.params.choices.save_as : 'url';
Severity: Major
Found in packages/kirki-framework/control-image/src/control.js - About 3 hrs to fix

Consider simplifying this complex logical expression.
Open

if (_dereq_(36)) {
  var LIBRARY = _dereq_(65);
  var global = _dereq_(46);
  var fails = _dereq_(42);
  var $export = _dereq_(40);
Severity: Critical
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 3 hrs to fix

Function 71 has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

},{"123":123,"42":42,"47":47,"57":57,"75":75}],71:[function(_dereq_,module,exports){
var global = _dereq_(46);
var macrotask = _dereq_(112).set;
var Observer = global.MutationObserver || global.WebKitMutationObserver;
var process = global.process;
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 3 hrs 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 kirkiTypographyCompositeControlFontProperties has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function kirkiTypographyCompositeControlFontProperties(id, value) {
  const control = wp.customize.control(id);

  if ("undefined" === typeof control) {
    return;
Severity: Minor
Found in packages/kirki-framework/field-typography/src/control.js - About 3 hrs 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 28 has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

},{"125":125,"15":15,"32":32,"36":36,"45":45,"61":61,"63":63,"70":70,"74":74,"75":75,"93":93,"99":99}],28:[function(_dereq_,module,exports){
'use strict';
var redefineAll = _dereq_(93);
var getWeak = _dereq_(70).getWeak;
var anObject = _dereq_(16);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 3 hrs 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 compare_values has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public static function compare_values( $value1, $value2, $operator ) {
        if ( '===' === $operator ) {
            return $value1 === $value2;
        }
        if ( '!==' === $operator ) {
Severity: Minor
Found in packages/kirki-framework/util/src/Helper.php - About 3 hrs 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_font_family_choices has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    private function get_font_family_choices() {

        $args = $this->args;

        // Figure out how to sort the fonts.
Severity: Minor
Found in packages/kirki-framework/field-typography/src/Field/Typography.php - About 3 hrs 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 convertColorForCustomizer has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const convertColorForCustomizer = (value, pickerComponent, formComponent) => {
    let rgba;
    let hsv;
    let hsva;
    let convertedValue;

Function KirkiSliderForm has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const KirkiSliderForm = (props) => {
  const { control, customizerSetting, choices } = props;

  let trigger = "";

Severity: Minor
Found in packages/kirki-framework/control-slider/src/KirkiSliderForm.js - About 3 hrs 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 43 has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

},{}],43:[function(_dereq_,module,exports){
'use strict';
_dereq_(224);
var redefine = _dereq_(94);
var hide = _dereq_(48);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 3 hrs 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 apply_value_pattern has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    protected function apply_value_pattern( $output, $value ) {
        if ( isset( $output['value_pattern'] ) && is_string( $output['value_pattern'] ) ) {
            if ( ! is_array( $value ) ) {
                $value = str_replace( '$', $value, $output['value_pattern'] );
            }
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 3 hrs 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 fromOutput has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        fromOutput: function( output, value, controlType ) {
            var styles      = '',
                mediaQuery  = false,
                processedValue;

Severity: Major
Found in packages/kirki-framework/module-postmessage/src/postMessage.js - About 3 hrs to fix

Method sanitize has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sanitize( $value ) {

        // is the value formatted as a string?
        if ( is_string( $value ) ) {
            $value = rawurldecode( $value );
Severity: Major
Found in packages/kirki-framework/control-repeater/src/Field/Repeater.php - About 3 hrs to fix

Function kirkiTypographyCompositeControlFontProperties has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function kirkiTypographyCompositeControlFontProperties(id, value) {
  const control = wp.customize.control(id);

  if ("undefined" === typeof control) {
    return;
Severity: Major
Found in packages/kirki-framework/field-typography/src/control.js - About 3 hrs to fix

Function 25 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

},{"11":11,"52":52,"57":57}],25:[function(_dereq_,module,exports){
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = _dereq_(26);
var TAG = _dereq_(128)('toStringTag');
// ES3 wrong here
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 3 hrs 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 KirkiSliderForm has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const KirkiSliderForm = (props) => {
  const { control, customizerSetting, choices } = props;

  let trigger = "";

Severity: Major
Found in packages/kirki-framework/control-slider/src/KirkiSliderForm.js - About 3 hrs to fix
Severity
Category
Status
Source
Language