deep-web-solutions/wordpress-framework-utilities

View on GitHub

Showing 32 of 57 total issues

Method add_action has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function add_action( string $hook, ?object $component, string $callback, int $priority = 10, int $accepted_args = 1 );
Severity: Minor
Found in src/includes/Hooks/HooksAdapterInterface.php - About 35 mins to fix

    Method validate_allowed_value has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function validate_allowed_value( $value, string $default_key, string $options_key, string $validation_type, string $handler_id = 'settings' ) {
    Severity: Minor
    Found in src/includes/Validation/ValidationService.php - About 35 mins to fix

      Method remove_filter has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function remove_filter( string $hook, ?object $component, string $callback, int $priority = 10, string $handler_id = 'buffered' ): void {
      Severity: Minor
      Found in src/includes/Hooks/HooksService.php - About 35 mins to fix

        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function __construct( PluginInterface $plugin, LoggingService $logging_service, HooksService $hooks_service, array $stores = array(), array $handlers = array() ) {
        Severity: Minor
        Found in src/includes/AdminNotices/AdminNoticesService.php - About 35 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public function remove_filter( string $hook, ?object $component, string $callback, int $priority = 10 ): void {
                  parent::remove_filter( $hook, $component, $callback, $priority );
          
                  if ( empty( $component ) ) {
                      \remove_filter( $hook, $callback, $priority );
          Severity: Minor
          Found in src/includes/Hooks/Handlers/DirectHooksHandler.php and 1 other location - About 35 mins to fix
          src/includes/Hooks/Handlers/DirectHooksHandler.php on lines 59..67

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 92.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public function remove_action( string $hook, ?object $component, string $callback, int $priority = 10 ): void {
                  parent::remove_action( $hook, $component, $callback, $priority );
          
                  if ( empty( $component ) ) {
                      \remove_action( $hook, $callback, $priority );
          Severity: Minor
          Found in src/includes/Hooks/Handlers/DirectHooksHandler.php and 1 other location - About 35 mins to fix
          src/includes/Hooks/Handlers/DirectHooksHandler.php on lines 103..111

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 92.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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