aristath/kirki

View on GitHub

Showing 644 of 644 total issues

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

},{"40":40}],173:[function(_dereq_,module,exports){
// 20.2.2.28 Math.sign(x)
var $export = _dereq_(40);

$export($export.S, 'Math', { sign: _dereq_(69) });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3361..3367
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3622..3628
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3765..3771
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3827..3833
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3978..3984
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4257..4262
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4815..4821

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

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

Method getNew has 35 lines of code (exceeds 25 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 1 hr to fix

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

},{"40":40,"46":46}],180:[function(_dereq_,module,exports){
// 20.1.2.3 Number.isInteger(number)
var $export = _dereq_(40);

$export($export.S, 'Number', { isInteger: _dereq_(56) });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3361..3367
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3622..3628
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3765..3771
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3827..3833
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3843..3849
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4257..4262
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4815..4821

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

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

},{"57":57,"85":85}],200:[function(_dereq_,module,exports){
// 19.1.3.10 Object.is(value1, value2)
var $export = _dereq_(40);
$export($export.S, 'Object', { is: _dereq_(97) });

packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3361..3367
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3622..3628
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3765..3771
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3827..3833
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3843..3849
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3978..3984
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4815..4821

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

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

Method download_font_file has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function download_font_file( $url ) {

        $saved_fonts = get_option( 'kirki_font_local_filenames', [] );
        if ( isset( $saved_fonts[ $url ] ) && file_exists( $saved_fonts[ $url ]['file'] ) ) {
            return str_replace(
Severity: Minor
Found in packages/kirki-framework/module-webfonts/src/Webfonts/Helper.php - About 1 hr to fix

Method process_value has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function process_value() {
        $this->value = trim( $this->value );

        // If you use calc() there, I suppose you know what you're doing.
        // No need to process this any further, just exit.

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

},{"40":40,"66":66}],167:[function(_dereq_,module,exports){
// 20.2.2.16 Math.fround(x)
var $export = _dereq_(40);

$export($export.S, 'Math', { fround: _dereq_(67) });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3361..3367
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3622..3628
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3827..3833
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3843..3849
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3978..3984
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4257..4262
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4815..4821

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

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

},{"94":94}],156:[function(_dereq_,module,exports){
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
var $export = _dereq_(40);

$export($export.P, 'Function', { bind: _dereq_(24) });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3361..3367
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3765..3771
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3827..3833
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3843..3849
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3978..3984
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4257..4262
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4815..4821

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

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

},{"40":40}],171:[function(_dereq_,module,exports){
// 20.2.2.20 Math.log1p(x)
var $export = _dereq_(40);

$export($export.S, 'Math', { log1p: _dereq_(68) });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3361..3367
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3622..3628
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3765..3771
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3843..3849
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3978..3984
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4257..4262
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4815..4821

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

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

},{"16":16,"40":40}],219:[function(_dereq_,module,exports){
// 26.1.11 Reflect.ownKeys(target)
var $export = _dereq_(40);

$export($export.S, 'Reflect', { ownKeys: _dereq_(87) });
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3361..3367
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3622..3628
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3765..3771
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3827..3833
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3843..3849
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 3978..3984
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 4257..4262

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

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

        processValue: function( output, value ) {
            var self     = this,
                settings = window.parent.wp.customize.get(),
                excluded = false;

Severity: Minor
Found in packages/kirki-framework/module-postmessage/src/postMessage.js - About 1 hr to fix

Function initCropperFrame has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initCropperFrame: function() {

        // We get the field id from which this was called
        var currentFieldId = this.$thisButton.siblings( 'input.hidden-field' ).attr( 'data-field' ),
            attrs          = [ 'width', 'height', 'flex_width', 'flex_height' ], // A list of attributes to look for
Severity: Minor
Found in packages/kirki-framework/control-repeater/src/control.js - About 1 hr to fix

Method enqueue_control_scripts has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function enqueue_control_scripts() {

        wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' );

        wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true );
Severity: Minor
Found in packages/kirki-framework/field-typography/src/Field/Typography.php - About 1 hr to fix

Method set_output has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function set_output() {
        if ( empty( $this->output ) ) {
            return;
        }
        if ( ! is_array( $this->output ) ) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/Field.php - About 1 hr to fix

Method content_template has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function content_template() {
        ?>
        <label class="customize-control-label" for="{{ ! data.choices.id ? 'customize-input-' + data.id : data.choices.id }}">
            <span class="customize-control-title">{{{ data.label }}}</span>
            <# if ( data.description ) { #>
Severity: Minor
Found in packages/kirki-framework/control-generic/src/Control/Generic.php - About 1 hr to fix

Similar blocks of code found in 2 locations. 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){
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 805..805

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

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

},{"100":100,"15":15,"40":40,"42":42,"45":45,"46":46,"51":51,"57":57,"62":62,"70":70,"93":93,"94":94}],30:[function(_dereq_,module,exports){
packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js on lines 631..631

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

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

Consider simplifying this complex logical expression.
Open

                if ( 4 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) && isset( $color[3] ) ) {
                    $this->color = 'rgba(' . intval( $color[0] ) . ',' . intval( $color[1] ) . ',' . intval( $color[2] ) . ',' . intval( $color[3] ) . ')';
                    return 'rgba';
                } elseif ( 3 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) ) {
                    // Is this a simple array with 3 items?
Severity: Critical
Found in lib/class-aricolor.php - About 1 hr to fix

Function createRunHook has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createRunHook(hooks, returnFirstArg) {
  /**
   * Runs all callbacks for the specified hook.
   *
   * @param  {string} hookName The name of the hook to run.
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js - About 1 hr to fix

Function load has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Typekit.prototype.load = function(onReady) {
    var kitId = this.configuration_['id'];
    var configuration = this.configuration_;
    var loadWindow = this.domHelper_.getLoadWindow();
    var that = this;
Severity
Category
Status
Source
Language