aristath/kirki

View on GitHub

Showing 644 of 644 total issues

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

    public function __construct( $config_id = 'global', $args = [] ) {

        // In case the user only provides 1 argument,
        // assume that the provided argument is $args and set $config_id = 'global'.
        if ( is_array( $config_id ) && empty( $args ) ) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/Field.php - About 1 hr to fix

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

Method get_value has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function get_value( $config_id = '', $field_id = '' ) {

        // Make sure value is defined.
        $value = '';

Severity: Minor
Found in packages/kirki-framework/compatibility/src/Values.php - About 1 hr to fix

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

          (hooks.__current || []).forEach(function (hookInfo) {
            if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
              hookInfo.currentIndex--;
            }
          });
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js and 1 other location - About 1 hr to fix
packages/kirki-framework/compatibility/src/scripts/hooks.js on lines 234..238

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

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

      (hooks.__current || []).forEach(function (hookInfo) {
        if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
          hookInfo.currentIndex++;
        }
      });
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js and 1 other location - About 1 hr to fix
packages/kirki-framework/compatibility/src/scripts/hooks.js on lines 317..321

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

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

    checkCondition: function( requirement, control, isOption, relation ) {
        var self          = this,
            childRelation = ( 'AND' === relation ) ? 'OR' : 'AND',
            nestedItems,
            value,
Severity: Minor
Found in packages/kirki-framework/module-field-dependencies/src/script.js - About 1 hr to fix

Function 226 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"36":36,"44":44,"75":75}],226:[function(_dereq_,module,exports){
'use strict';

var anObject = _dereq_(16);
var toLength = _dereq_(117);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function 137 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"104":104,"20":20,"40":40}],137:[function(_dereq_,module,exports){
'use strict';
var ctx = _dereq_(32);
var $export = _dereq_(40);
var toObject = _dereq_(118);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function 74 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"118":118,"42":42,"53":53,"80":80,"83":83,"84":84}],74:[function(_dereq_,module,exports){
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = _dereq_(16);
var dPs = _dereq_(76);
var enumBugKeys = _dereq_(38);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Method render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function render() {

        $id    = 'customize-control-' . str_replace( [ '[', ']' ], [ '-', '' ], $this->id );
        $class = 'customize-control customize-control-kirki customize-control-' . $this->type;
        $gap   = isset( $this->wrapper_opts['gap'] ) ? $this->wrapper_opts['gap'] : 'default';
Severity: Minor
Found in packages/kirki-framework/control-base/src/Control/Base.php - About 1 hr to fix

Function 82 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

},{"101":101,"118":118,"47":47}],82:[function(_dereq_,module,exports){
var has = _dereq_(47);
var toIObject = _dereq_(116);
var arrayIndexOf = _dereq_(19)(false);
var IE_PROTO = _dereq_(101)('IE_PROTO');
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 98 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

},{}],98:[function(_dereq_,module,exports){
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = _dereq_(57);
var anObject = _dereq_(16);
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 77 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

},{"16":16,"36":36,"75":75,"83":83}],77:[function(_dereq_,module,exports){
var pIE = _dereq_(84);
var createDesc = _dereq_(92);
var toIObject = _dereq_(116);
var toPrimitive = _dereq_(119);
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 row_label has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function row_label( $args ) {

        // Validating args for row labels.
        if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) {

Severity: Minor
Found in packages/kirki-framework/control-repeater/src/Control/Repeater.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 getLoader has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getLoader()
    {
        if (null !== self::$loader) {
            return self::$loader;
        }
Severity: Minor
Found in packages/composer/autoload_real.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 css_dimension has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function css_dimension( $value ) {

        // Trim it.
        $value = trim( $value );

Severity: Minor
Found in packages/kirki-framework/compatibility/src/Sanitize_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 filter_setting_args has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

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

            // Set the sanitize-callback if none is defined.
Severity: Minor
Found in packages/kirki-framework/control-image/src/Field/Image.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

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

      } else if (3 === val.length || 6 === val.length) {
        if (!val.includes("#") && !val.includes("rg") && !val.includes("hs")) {
          val = "#" + val;
        }
      }
packages/kirki-framework/control-react-colorful/src/js/components/KirkiReactColorfulInput.js on lines 12..20

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

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

    protected function process_output( $output, $value ) {
        foreach ( $value as $key => $sub_value ) {

            // If "element" is not defined, there's no reason to continue.
            if ( ! isset( $output['element'] ) ) {

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

    protected function render() {

        $id    = 'customize-control-' . str_replace( [ '[', ']' ], [ '-', '' ], $this->id );
        $class = 'customize-control customize-control-kirki customize-control-' . $this->type;
        $gap   = isset( $this->wrapper_opts['gap'] ) ? $this->wrapper_opts['gap'] : 'default';
Severity: Minor
Found in packages/kirki-framework/control-base/src/Control/Base.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

Severity
Category
Status
Source
Language