aristath/kirki

View on GitHub

Showing 644 of 644 total issues

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

},{"40":40,"88":88}],207:[function(_dereq_,module,exports){
var $export = _dereq_(40);
var $parseInt = _dereq_(89);
// 18.2.5 parseInt(string, radix)
$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4312..4318

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 3 locations. Consider refactoring.
Open

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

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 3 locations. Consider refactoring.
Open

      if (rgba.a < 1) {
        convertedValue =
          "string" === typeof value && value.includes("rgba")
            ? value
            : colord(value).toRgbString();
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 76..92

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

Function 105 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

},{"42":42}],105:[function(_dereq_,module,exports){
var toInteger = _dereq_(115);
var defined = _dereq_(35);
// true  -> String#at
// false -> String#codePointAt
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 set_js_vars has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_js_vars() {
        if ( ! is_array( $this->js_vars ) ) {
            $this->js_vars = [];
        }

Severity: Minor
Found in packages/kirki-framework/compatibility/src/Field.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 memize has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function memize( fn, options ) {
    var size = 0,
        maxSize, head, tail;

    if ( options && options.maxSize ) {
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/i18n.js - About 2 hrs to fix

Method parse_output has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function parse_output() {
        foreach ( $this->output as $output ) {
            $skip = false;

            // Apply any sanitization callbacks defined.
Severity: Major
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 2 hrs to fix

ClassLoader has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class ClassLoader
{
    /** @var ?string */
    private $vendorDir;

Severity: Minor
Found in packages/composer/ClassLoader.php - About 2 hrs to fix

ariColor has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

    class ariColor {

        /**
         * An array of our instances.
         *
Severity: Minor
Found in lib/class-aricolor.php - About 2 hrs to fix

Function RepeaterRow has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var RepeaterRow = function( rowIndex, container, label, control ) {
    var self        = this;
    this.rowIndex   = rowIndex;
    this.container  = container;
    this.label      = label;
Severity: Major
Found in packages/kirki-framework/control-repeater/src/control.js - About 2 hrs to fix

Function 96 has a Cognitive Complexity of 18 (exceeds 5 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 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 field_init has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function field_init( $args, $object ) {
        if ( ! isset( $args['output'] ) ) {
            $args['output'] = array();
        }

Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS.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 process_output has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function process_output( $output, $value ) {

        $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
        $output['element']     = ( isset( $output['element'] ) ) ? $output['element'] : 'body';
        $output['prefix']      = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';

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

    public function init( $args = array() ) {

        add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
        add_action( 'customize_preview_init', array( $this, 'enqueue_customize_preview_scripts' ) );
        add_filter( 'kirki_output_control_classnames', array( $this, 'output_control_classnames' ) );
Severity: Minor
Found in packages/kirki-framework/field-dimensions/src/Dimensions.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 filter_control_args has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function filter_control_args( $args, $wp_customize ) {
        if ( $args['settings'] === $this->args['settings'] ) {
            $args = parent::filter_control_args( $args, $wp_customize );

            $args['type'] = 'code_editor';
Severity: Minor
Found in packages/kirki-framework/control-code/src/Field/Code.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 set_js_vars has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_js_vars() {

        // Typecast to array.
        $this->js_vars = (array) $this->js_vars;

Severity: Minor
Found in packages/kirki-framework/field-background/src/Background.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 sanitize has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function sanitize( $value ) {

        if ( ! is_array( $value ) ) {
            return [];
        }
Severity: Minor
Found in packages/kirki-framework/field-typography/src/Field/Typography.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 61 has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"100":100,"128":128,"48":48,"74":74,"92":92}],61:[function(_dereq_,module,exports){
'use strict';
var LIBRARY = _dereq_(65);
var $export = _dereq_(40);
var redefine = _dereq_(94);
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 2 hrs to fix

Function sprintf_parse has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function sprintf_parse(fmt) {
        if (sprintf_cache[fmt]) {
            return sprintf_cache[fmt]
        }

Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/i18n.js - About 2 hrs to fix

Function convertColorForPicker has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const convertColorForPicker = (value, pickerComponent) => {
    let convertedValue;

    switch (pickerComponent) {
        case 'HexColorPicker':
Severity
Category
Status
Source
Language