aristath/kirki

View on GitHub

Showing 644 of 644 total issues

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

                            if ( '' === processedValue ) {
                                if ( 'background-color' === output.property ) {
                                    processedValue = 'unset';
                                } else if ( 'background-image' === output.property ) {
                                    processedValue = 'none';
packages/kirki-framework/field-background/src/script.js on lines 36..42
packages/kirki-framework/module-postmessage/src/postMessage.js on lines 214..220

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

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

    this.updateLabel = function() {
        var rowLabelField,
            rowLabel,
            rowLabelSelector;

Severity: Minor
Found in packages/kirki-framework/control-repeater/src/control.js - About 1 hr to fix

Method to_json has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function to_json() {

        // Get the basics from the parent class.
        parent::to_json();

Severity: Minor
Found in packages/kirki-framework/control-base/src/Control/Base.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

        if ( ! value || '' === value || 0 === value || '0' === value || 'auto' === value || 'inherit' === value || 'initial' === value ) {
            return true;
        }
Severity: Major
Found in packages/kirki-framework/control-dimension/src/control.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

            if (
                ( isset( $field['kirki_config'] ) && $config_id === $field['kirki_config'] ) ||
                (
                    ( 'global' === $config_id || ! $config_id ) &&
                    ( ! isset( $field['kirki_config'] ) || 'global' === $field['kirki_config'] || ! $field['kirki_config'] )
Severity: Major
Found in packages/kirki-framework/module-css/src/CSS.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

        if (
            self::is_plugin() ||
            false === strpos( $url, 'wordpress.org' ) || (
                ! isset( $request['body'] ) ||
                ! isset( $request['body']['plugins'] ) ||
Severity: Major
Found in packages/kirki-framework/util/src/Util.php - About 1 hr to fix

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

if (INCLUDE_MONOTYPE_MODULE) {
  webFontLoader.addModule(webfont.modules.Monotype.NAME, function (configuration, domHelper) {
    return new webfont.modules.Monotype(domHelper, configuration);
  });
}
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 51..55
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 57..61
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 69..73

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

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

if (INCLUDE_FONTDECK_MODULE) {
  webFontLoader.addModule(webfont.modules.Fontdeck.NAME, function (configuration, domHelper) {
    return new webfont.modules.Fontdeck(domHelper, configuration);
  });
}
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 51..55
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 63..67
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 69..73

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

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

if (INCLUDE_TYPEKIT_MODULE) {
  webFontLoader.addModule(webfont.modules.Typekit.NAME, function (configuration, domHelper) {
    return new webfont.modules.Typekit(domHelper, configuration);
  });
}
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 51..55
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 57..61
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 63..67

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

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

if (INCLUDE_CUSTOM_MODULE) {
  webFontLoader.addModule(webfont.modules.Custom.NAME, function (configuration, domHelper) {
    return new webfont.modules.Custom(domHelper, configuration);
  });
}
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 57..61
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 63..67
packages/kirki-framework/module-webfonts/src/assets/scripts/vendor-typekit/src/core/initialize.js on lines 69..73

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

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

(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(_dereq_,module,exports){
(function (global){
"use strict";

_dereq_(2);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - 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 39 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

},{}],39:[function(_dereq_,module,exports){
// all enumerable object keys, includes symbols
var getKeys = _dereq_(83);
var gOPS = _dereq_(80);
var pIE = _dereq_(84);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - 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 230 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

},{"103":103,"117":117,"14":14,"16":16,"43":43,"58":58,"95":95,"96":96}],230:[function(_dereq_,module,exports){
'use strict';
_dereq_(225);
var anObject = _dereq_(16);
var $flags = _dereq_(44);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - 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 147 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

},{"104":104,"21":21,"40":40}],147:[function(_dereq_,module,exports){
'use strict';
var $export = _dereq_(40);
var html = _dereq_(49);
var cof = _dereq_(26);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - 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 255 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

},{"100":100,"102":102,"116":116,"119":119,"123":123,"126":126,"127":127,"128":128,"16":16,"36":36,"39":39,"40":40,"42":42,"46":46,"47":47,"48":48,"55":55,"57":57,"65":65,"70":70,"74":74,"75":75,"77":77,"78":78,"79":79,"80":80,"83":83,"84":84,"92":92,"94":94}],255:[function(_dereq_,module,exports){
'use strict';
var $export = _dereq_(40);
var $typed = _dereq_(122);
var buffer = _dereq_(121);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - 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 110 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

},{"115":115,"35":35}],110:[function(_dereq_,module,exports){
var $export = _dereq_(40);
var defined = _dereq_(35);
var fails = _dereq_(42);
var spaces = _dereq_(111);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - 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 addPsr4 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function addPsr4($prefix, $paths, $prepend = false)
    {
        if (!$prefix) {
            // Register directories for the root namespace.
            if ($prepend) {
Severity: Minor
Found in packages/composer/ClassLoader.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 is_disabled has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function is_disabled( $args = [] ) {
        if ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) {
            return true;
        }

Severity: Minor
Found in packages/kirki-framework/module-editor-styles/src/Editor_Styles.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 rgb_to_hsv has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function rgb_to_hsv( $color = array() ) {
        $var_r = ( $color[0] / 255 );
        $var_g = ( $color[1] / 255 );
        $var_b = ( $color[2] / 255 );
        $var_min = min( $var_r, $var_g, $var_b );
Severity: Minor
Found in lib/class-kirki-color.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 from_hsl_array has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        protected function from_hsl_array() {
            $h = $this->hue / 360;
            $s = $this->saturation / 100;
            $l = $this->lightness / 100;

Severity: Minor
Found in lib/class-aricolor.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

Severity
Category
Status
Source
Language