deep-web-solutions/wordpress-framework-utilities

View on GitHub

Showing 26 of 57 total issues

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

    public function get_missing_dependencies(): array {
        $missing = array();

        foreach ( $this->get_dependencies() as $dependency ) {
            $is_active = $this->is_plugin_active( $dependency['plugin'], $dependency );
Severity: Minor
Found in src/includes/Dependencies/Checkers/WPPluginsChecker.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

Avoid too many return statements within this method.
Open

                return $this->validate_float( $value, $default_key, $handler_id );
Severity: Major
Found in src/includes/Validation/ValidationService.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return $this->validate_callable( $value, $default_key, $handler_id );
    Severity: Major
    Found in src/includes/Validation/ValidationService.php - About 30 mins to fix

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

          protected function get_container_value( string $key ) {
              $boom = \explode( '/', $key );
              $key  = \array_shift( $boom );
      
              $value = $this->get_container_entry( $key );
      Severity: Minor
      Found in src/includes/Validation/Handlers/ContainerValidationHandler.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 get_container_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function get_container_value( string $key, string $container_id ) {
              $boom = \explode( '/', $key );
              $key  = \array_shift( $boom );
      
              $value = $this->get_container_entry( $key, $container_id );
      Severity: Minor
      Found in src/includes/Validation/Handlers/MultiContainerValidationHandler.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 get_dependencies_handler_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_dependencies_handler_id( ?string $context = null ): string {
              switch ( $context ) {
                  case DependencyContextsEnum::ACTIVE_STATE:
                      $handler_id = 'active_%s';
                      break;
      Severity: Minor
      Found in src/includes/Dependencies/Helpers/DependenciesHelpersTrait.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