aristath/kirki

View on GitHub

Showing 449 of 644 total issues

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

  Monotype.prototype.load = function(onReady) {
    var self = this;
    var projectId = self.configuration_['projectId'];
    var version = self.configuration_['version'];
  

Method compare_values has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function compare_values( $value1, $value2, $operator ) {
        if ( '===' === $operator ) {
            return $value1 === $value2;
        }
        if ( '!==' === $operator ) {
Severity: Minor
Found in packages/kirki-framework/util/src/Helper.php - About 1 hr to fix

Function dispatchException has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    dispatchException: function(exception) {
      if (this.done) {
        throw exception;
      }

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

Method the_css has 42 lines of code (exceeds 25 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

Method field_init has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function field_init( $args, $object ) {
        if ( ! isset( $args['output'] ) ) {
            $args['output'] = array();
        }

Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS.php - About 1 hr to fix

Function watchFonts has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  FontWatcher.prototype.watchFonts = function(fonts,
      fontTestStrings, metricCompatibleFonts, last) {
    var length = fonts.length,
        testStrings = fontTestStrings || {};

Method loop_controls has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function loop_controls( $config_id ) {

        // Get an instance of the Generator class.
        // This will make sure google fonts and backup fonts are loaded.
        Generator::get_instance();
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS.php - About 1 hr to fix

Function 17 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

},{"57":57}],17:[function(_dereq_,module,exports){
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
'use strict';
var toObject = _dereq_(118);
var toAbsoluteIndex = _dereq_(113);
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 checkCondition has a Cognitive Complexity of 13 (exceeds 5 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

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_value has a Cognitive Complexity of 13 (exceeds 5 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

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

    public function process_fonts() {

        // Early exit if font-family is empty.
        if ( empty( $this->fonts ) ) {
            return;
Severity: Minor
Found in packages/kirki-framework/module-webfonts/src/Webfonts/Google.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 createRemoveHook has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createRemoveHook(hooks, removeAll) {
  /**
   * Removes the specified callback (or all callbacks) from the hook with a
   * given hookName and namespace.
   *
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js - About 1 hr to fix

Function 223 has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"16":16,"40":40,"47":47,"57":57,"75":75,"77":77,"81":81,"92":92}],223:[function(_dereq_,module,exports){
var global = _dereq_(46);
var inheritIfRequired = _dereq_(51);
var dP = _dereq_(75).f;
var gOPN = _dereq_(79).f;
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function 255 has 39 lines of code (exceeds 25 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 1 hr to fix

Method sanitize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function sanitize( $value ) {

        if ( ! is_array( $value ) ) {
            return [];
        }
Severity: Minor
Found in packages/kirki-framework/field-typography/src/Field/Typography.php - About 1 hr to fix

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

    protected function process_output( $output, $value ) {

        $output = wp_parse_args(
            $output,
            array(

Function AsyncIterator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function AsyncIterator(generator) {
    function invoke(method, arg, resolve, reject) {
      var record = tryCatch(generator[method], generator, arg);
      if (record.type === "throw") {
        reject(record.arg);
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function 20 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"113":113,"116":116,"117":117}],20:[function(_dereq_,module,exports){
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/wp-polyfill.js - About 1 hr to fix

Function removeHook has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  return function removeHook(hookName, namespace) {
    if (!build_module_validateHookName(hookName)) {
      return;
    }

Severity: Minor
Found in packages/kirki-framework/compatibility/src/scripts/hooks.js - About 1 hr to fix

Function KirkiReactColorfulCircle has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const KirkiReactColorfulCircle = (props) => {
  const { color = "" } = props;
  const [value, setValue] = useState(() => color);

  // Update the local state when `color` property value is changed.
Severity
Category
Status
Source
Language