aristath/kirki

View on GitHub

Showing 644 of 644 total issues

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

},{"208":208,"272":272,"30":30}],8:[function(_dereq_,module,exports){
_dereq_(273);
module.exports = _dereq_(30).String.padEnd;

},{"273":273,"30":30}],9:[function(_dereq_,module,exports){
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 174..178
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 178..182
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 182..186
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 186..190
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 200..204

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

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

},{"269":269,"30":30}],5:[function(_dereq_,module,exports){
_dereq_(270);
module.exports = _dereq_(30).Object.getOwnPropertyDescriptors;

},{"270":270,"30":30}],6:[function(_dereq_,module,exports){
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 174..178
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 178..182
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 186..190
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 196..200
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 200..204

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

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

},{"130":130,"131":131,"132":132,"133":133,"134":134,"135":135,"136":136,"137":137,"138":138,"139":139,"140":140,"141":141,"142":142,"143":143,"144":144,"145":145,"146":146,"147":147,"148":148,"149":149,"150":150,"151":151,"152":152,"153":153,"154":154,"155":155,"156":156,"157":157,"158":158,"159":159,"160":160,"161":161,"162":162,"163":163,"164":164,"165":165,"166":166,"167":167,"168":168,"169":169,"170":170,"171":171,"172":172,"173":173,"174":174,"175":175,"176":176,"177":177,"178":178,"179":179,"180":180,"181":181,"182":182,"183":183,"184":184,"185":185,"186":186,"187":187,"188":188,"189":189,"190":190,"191":191,"192":192,"193":193,"194":194,"195":195,"196":196,"197":197,"198":198,"199":199,"200":200,"201":201,"202":202,"203":203,"204":204,"205":205,"206":206,"207":207,"208":208,"209":209,"210":210,"211":211,"212":212,"213":213,"214":214,"215":215,"216":216,"217":217,"218":218,"219":219,"220":220,"221":221,"222":222,"223":223,"224":224,"225":225,"226":226,"227":227,"228":228,"229":229,"230":230,"231":231,"232":232,"233":233,"234":234,"235":235,"236":236,"237":237,"238":238,"239":239,"240":240,"241":241,"242":242,"243":243,"244":244,"245":245,"246":246,"247":247,"248":248,"249":249,"250":250,"251":251,"252":252,"253":253,"254":254,"255":255,"256":256,"257":257,"258":258,"259":259,"260":260,"261":261,"262":262,"263":263,"264":264,"265":265,"266":266,"267":267,"30":30}],3:[function(_dereq_,module,exports){
_dereq_(268);
module.exports = _dereq_(30).Array.includes;

},{"268":268,"30":30}],4:[function(_dereq_,module,exports){
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 178..182
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 182..186
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 186..190
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 196..200
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 200..204

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

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

},{"270":270,"30":30}],6:[function(_dereq_,module,exports){
_dereq_(271);
module.exports = _dereq_(30).Object.values;

},{"271":271,"30":30}],7:[function(_dereq_,module,exports){
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 174..178
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 178..182
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 182..186
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 196..200
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 200..204

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

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

},{"22":22}],24:[function(_dereq_,module,exports){
'use strict';
var aFunction = _dereq_(11);
var isObject = _dereq_(57);
var invoke = _dereq_(52);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr 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 44 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

},{"128":128,"224":224,"35":35,"42":42,"48":48,"94":94,"96":96}],44:[function(_dereq_,module,exports){
'use strict';
// 21.2.5.3 get RegExp.prototype.flags
var anObject = _dereq_(16);
module.exports = function () {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr 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 66 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

},{}],66:[function(_dereq_,module,exports){
// 20.2.2.14 Math.expm1(x)
var $expm1 = Math.expm1;
module.exports = (!$expm1
  // Old FF bug
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr 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 findFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function findFile($class)
    {
        // class map lookup
        if (isset($this->classMap[$class])) {
            return $this->classMap[$class];
Severity: Minor
Found in packages/composer/ClassLoader.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function sanitize( $value ) {

        $sanitized_value = '';

        if ( is_string( $value ) ) {

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

    public function webfont_loader() {

        // Go through our fields and populate $this->fonts.
        $this->webfonts->loop_fields( $this->config_id );

Severity: Minor
Found in packages/kirki-framework/module-webfonts/src/Webfonts/Async.php - About 1 hr 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_hsl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        protected function set_hsl() {
            $red   = $this->red / 255;
            $green = $this->green / 255;
            $blue  = $this->blue / 255;

Severity: Minor
Found in lib/class-aricolor.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function process_output( $output, $value ) {

        $output = wp_parse_args(
            $output,
            array(

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

    public static function get_sanitized_field_value( $field ) {
        $value = $field['default'];
        if ( ! isset( $field['option_type'] ) || 'theme_mod' === $field['option_type'] ) {
            $value = get_theme_mod( $field['settings'], $field['default'] );
        } elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/Values.php - About 1 hr 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 21 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"117":117,"118":118,"23":23,"32":32,"53":53}],21:[function(_dereq_,module,exports){
var aFunction = _dereq_(11);
var toObject = _dereq_(118);
var IObject = _dereq_(53);
var toLength = _dereq_(117);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function validateCssValue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    validateCssValue: function( value ) {

        var control = this,
            validUnits = [ 'fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax' ],
            numericValue,
Severity: Minor
Found in packages/kirki-framework/control-dimension/src/control.js - About 1 hr to fix

Method http_request has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function http_request( $request = [], $url = '' ) {

        // Early exit if installed as a plugin or not a request to wordpress.org,
        // or finally if we don't have everything we need.
        if (
Severity: Minor
Found in packages/kirki-framework/util/src/Util.php - About 1 hr to fix

Method process_output has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function process_output( $output, $value ) {
        $output = wp_parse_args(
            $output,
            [
                'element'     => '',
Severity: Minor
Found in packages/kirki-framework/field-dimensions/src/CSS/Dimensions.php - About 1 hr to fix

Method sanitize_color_array has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function sanitize_color_array( $color, $color_type = 'rgb' ) {

        $keys = [ 'r', 'g', 'b' ];
        $mins = [ 0, 0, 0 ];
        $maxs = [ 255, 255, 255 ];

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';
Severity: Major
Found in packages/kirki-framework/field-background/src/script.js and 2 other locations - About 1 hr to fix
packages/kirki-framework/module-postmessage/src/postMessage.js on lines 171..177
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

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 171..177

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

Severity
Category
Status
Source
Language