aristath/kirki

View on GitHub

Showing 449 of 644 total issues

Function set_active_callback has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_active_callback() {
        if ( is_array( $this->active_callback ) ) {
            if ( ! is_callable( $this->active_callback ) ) {

                // Bugfix for https://github.com/aristath/kirki/issues/1961.
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 set_output has a Cognitive Complexity of 16 (exceeds 5 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 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 getConstructor has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
    var C = wrapper(function (that, iterable) {
      anInstance(that, C, NAME, '_i');
      that._t = NAME;         // collection type
      that._i = create(null); // index
Severity: Major
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 2 hrs to fix

Function memoized has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function memoized( /* ...args */ ) {
        var node = head,
            len = arguments.length,
            args, i;

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

Consider simplifying this complex logical expression.
Open

    if (isTAIndex(target, key = toPrimitive(key, true))
      && isObject(desc)
      && has(desc, 'value')
      && !has(desc, 'get')
      && !has(desc, 'set')
Severity: Critical
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 2 hrs to fix

Function invoke has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    return function invoke(method, arg) {
      if (state === GenStateExecuting) {
        throw new Error("Generator is already running");
      }

Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 2 hrs to fix

Method init has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function init( $args ) {

        add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] );

        /**
Severity: Minor
Found in packages/kirki-framework/field-multicolor/src/Field/Multicolor.php - About 2 hrs to fix

Function createAddHook has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createAddHook(hooks) {
  /**
   * Adds the hook to the appropriate hooks container.
   *
   * @param {string}   hookName  Name of hook to add
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js - About 1 hr to fix

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

    protected function content_template() {
        ?>
        <# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
        <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
        <div class="icons-wrapper">

Method apply_pattern_replace has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function apply_pattern_replace( $output, $value ) {
        if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) {
            $option_type = ( isset( $this->field['option_type'] ) ) ? $this->field['option_type'] : 'theme_mod';
            $option_name = ( isset( $this->field['option_name'] ) ) ? $this->field['option_name'] : '';
            $options     = [];
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 1 hr to fix

Method findFileWithExtension has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function findFileWithExtension($class, $ext)
    {
        // PSR-4 lookup
        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;

Severity: Minor
Found in packages/composer/ClassLoader.php - About 1 hr to fix

Function 266 has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"120":120}],266:[function(_dereq_,module,exports){
'use strict';
var each = _dereq_(20)(0);
var redefine = _dereq_(94);
var meta = _dereq_(70);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function addRow has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    addRow: function( data ) {
        var control       = this,
            template      = control.repeaterTemplate(), // The template for the new row (defined on Kirki_Customize_Repeater_Control::render_content() ).
            settingValue  = this.getValue(), // Get the current setting value.
            newRowSetting = {}, // Saves the new setting data.
Severity: Minor
Found in packages/kirki-framework/control-repeater/src/control.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 157 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

},{"24":24,"40":40}],157:[function(_dereq_,module,exports){
'use strict';
var isObject = _dereq_(57);
var getPrototypeOf = _dereq_(81);
var HAS_INSTANCE = _dereq_(128)('hasInstance');
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 216 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

},{"16":16,"40":40,"81":81}],216:[function(_dereq_,module,exports){
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
var gOPD = _dereq_(77);
var getPrototypeOf = _dereq_(81);
var has = _dereq_(47);
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 the_css has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function the_css() {
        foreach ( $this->fonts_to_load as $font ) {
            $family  = str_replace( ' ', '+', trim( $font['family'] ) );
            $weights = join( ',', $font['weights'] );
            $url     = "https://fonts.googleapis.com/css?family={$family}:{$weights}&subset=cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai";
Severity: Minor
Found in packages/kirki-framework/module-webfonts/src/Webfonts/Embed.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 addHook has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  return function addHook(hookName, namespace, callback) {
    var priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;

    if (!build_module_validateHookName(hookName)) {
      return;
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js - About 1 hr to fix

Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (KEY, length, exec) {
  var SYMBOL = wks(KEY);

  var DELEGATES_TO_SYMBOL = !fails(function () {
    // String methods call symbol-named RegEp methods
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function () {
  var head, last, notify;

  var flush = function () {
    var parent, fn;
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function toFixed has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  toFixed: function toFixed(fractionDigits) {
    var x = aNumberValue(this, ERROR);
    var f = toInteger(fractionDigits);
    var s = '';
    var m = ZERO;
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix
Severity
Category
Status
Source
Language