aristath/kirki

View on GitHub
packages/kirki-framework/module-css/src/CSS.php

Summary

Maintainability
D
1 day
Test Coverage

Function loop_controls has a Cognitive Complexity of 38 (exceeds 5 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 5 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 field_init has a Cognitive Complexity of 18 (exceeds 5 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 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

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

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

Consider simplifying this complex logical expression.
Open

            if (
                ( isset( $field['kirki_config'] ) && $config_id === $field['kirki_config'] ) ||
                (
                    ( 'global' === $config_id || ! $config_id ) &&
                    ( ! isset( $field['kirki_config'] ) || 'global' === $field['kirki_config'] || ! $field['kirki_config'] )
Severity: Major
Found in packages/kirki-framework/module-css/src/CSS.php - About 1 hr to fix

Function get_fields_by_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function get_fields_by_config( $config_id ) {
        $fields = array();
        foreach ( self::$fields as $field ) {
            if (
                ( isset( $field['kirki_config'] ) && $config_id === $field['kirki_config'] ) ||
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS.php - About 35 mins 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 print_styles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function print_styles() {

        // Go through all configs.
        $configs = Kirki::$config;

Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS.php - About 35 mins 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 enqueue_styles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function enqueue_styles() {

        $args = array(
            'action' => apply_filters( 'kirki_styles_action_handle', self::$css_handle ),
        );
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS.php - About 25 mins 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

There are no issues that match your filters.

Category
Status