aristath/kirki

View on GitHub

Showing 644 of 644 total issues

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

    initKirkiControl: function( control ) {
        var limit, theNewRow, settingValue;
        control = control || this;

        // The current value set in Control Class (set in Kirki_Customize_Repeater_Control::to_json() function)
Severity: Major
Found in packages/kirki-framework/control-repeater/src/control.js - About 2 hrs to fix

Method __construct has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct( $manager, $id, $args = [] ) {

        parent::__construct( $manager, $id, $args );

        // Set up defaults for row labels.
Severity: Major
Found in packages/kirki-framework/control-repeater/src/Control/Repeater.php - About 2 hrs to fix

Method get_mode has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function get_mode( $color ) {

            // Check if value is an array.
            if ( is_array( $color ) ) {
                // Does the array have an 'rgba' key?
Severity: Major
Found in lib/class-aricolor.php - About 2 hrs to fix

Function 33 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

},{"11":11}],33:[function(_dereq_,module,exports){
'use strict';
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
var fails = _dereq_(42);
var getTime = Date.prototype.getTime;
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 2 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 getNew has a Cognitive Complexity of 20 (exceeds 5 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 2 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 evaluate has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    evaluate: function( value1, value2, operator, choice ) {
        var found = false;

        if ( choice && 'object' === typeof value2 ) {
            value2 = value2[ choice ];
Severity: Major
Found in packages/kirki-framework/module-field-dependencies/src/script.js - About 2 hrs to fix

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

    public static function sanitize( $value ) {

        if ( ! is_array( $value ) ) {
            return [];
        }
Severity: Major
Found in packages/kirki-framework/field-background/src/Background.php - About 2 hrs to fix

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

},{"13":13,"19":19,"40":40}],269:[function(_dereq_,module,exports){
// https://github.com/tc39/proposal-object-values-entries
var $export = _dereq_(40);
var $entries = _dereq_(86)(true);

packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 6070..6081

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 89.

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

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

},{"116":116,"31":31,"40":40,"77":77,"87":87}],271:[function(_dereq_,module,exports){
// https://github.com/tc39/proposal-object-values-entries
var $export = _dereq_(40);
var $values = _dereq_(86)(false);

packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 6035..6046

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 89.

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

repeater has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

wp.customize.controlConstructor.repeater = wp.customize.Control.extend( {

    // When we're finished loading continue processing
    ready: function() {
        var control = this;
Severity: Minor
Found in packages/kirki-framework/control-repeater/src/control.js - About 2 hrs to fix

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

    case "HslaColorPicker":
      convertedValue = colord(value).toHslString();

      // Force to set the alpha value.
      if (convertedValue.includes("hsl") && !convertedValue.includes("hsla")) {
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForCustomizer.js on lines 93..102
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForPicker.js on lines 32..41
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForPicker.js on lines 56..65

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 88.

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

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

        case 'RgbaStringColorPicker':
            convertedValue = colord(value).toRgbString();

            // Force to set the alpha channel value.
            if (convertedValue.includes('rgb') && !convertedValue.includes('rgba')) {
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForCustomizer.js on lines 93..102
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForInput.js on lines 110..119
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForPicker.js on lines 56..65

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 88.

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

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

        case 'HslaStringColorPicker':
            convertedValue = colord(value).toHslString();

            // Force to set the alpha channel value.
            if (convertedValue.includes('hsl') && !convertedValue.includes('hsla')) {
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForInput.js on lines 110..119
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForPicker.js on lines 32..41
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForPicker.js on lines 56..65

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 88.

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

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

        case 'HslaStringColorPicker':
            convertedValue = colord(value).toHslString();

            // Force to set the alpha channel value.
            if (convertedValue.includes('hsl') && !convertedValue.includes('hsla')) {
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForCustomizer.js on lines 93..102
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForInput.js on lines 110..119
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForPicker.js on lines 32..41

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 88.

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

  DomHelper.prototype.loadStylesheet = function (href, opt_callback, opt_async) {
    var link = this.createElement('link', {
      'rel': 'stylesheet',
      'href': href,
      'media': (opt_async ? 'only x' : 'all')

Function 41 has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

/***/ (function(module, exports, __webpack_require__) {

module.exports = function memize( fn, options ) {
    var size = 0,
        maxSize, head, tail;
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/i18n.js - About 2 hrs to fix

Method get_font_family_choices has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function get_font_family_choices() {

        $args = $this->args;

        // Figure out how to sort the fonts.
Severity: Major
Found in packages/kirki-framework/field-typography/src/Field/Typography.php - About 2 hrs to fix

File ClassLoader.php has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of Composer.
 *
Severity: Minor
Found in packages/composer/ClassLoader.php - About 2 hrs to fix

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

      if (rgba.a == 1 && !formComponent) {
        convertedValue =
          "string" === typeof value && value.includes("#")
            ? value
            : colord(value).toHex();
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForCustomizer.js on lines 59..72
packages/kirki-framework/control-react-colorful/src/js/utils/convertColorForInput.js on lines 47..63

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 87.

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

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

},{"128":128,"25":25,"94":94}],206:[function(_dereq_,module,exports){
var $export = _dereq_(40);
var $parseFloat = _dereq_(88);
// 18.2.4 parseFloat(string)
$export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4318..4324

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 87.

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

Severity
Category
Status
Source
Language