aristath/kirki

View on GitHub

Showing 644 of 644 total issues

Function to_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function to_json() {

        parent::to_json();

        $this->json['value'] = strtolower( $this->json['value'] );

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

    public static function sanitize_color_string( $value ) {

        /**
         * This pattern will check and match 3/6/8-character hex, rgb, rgba, hsl, hsla, hsv, and hsva colors.
         *

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

    private function use_local_files( $css ) {
        preg_match_all( '/https\:.*?\.woff/', $css, $matches );

        $matches = array_shift( $matches );

Severity: Minor
Found in packages/kirki-framework/module-webfonts/src/Webfonts/Embed.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

Function set_css_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set_css_vars() {
        if ( is_string( $this->css_vars ) ) {
            $this->css_vars = [ $this->css_vars ];
        }
        if ( isset( $this->css_vars[0] ) && is_string( $this->css_vars[0] ) ) {
Severity: Minor
Found in packages/kirki-framework/compatibility/src/Field.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

Severity
Category
Status
Source
Language