Skip to content

Commit

Permalink
tw-review
Browse files Browse the repository at this point in the history
  • Loading branch information
andriitserkovnyi committed Sep 14, 2023
1 parent f020767 commit 73ac4b5
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FormDependencyProvider extends SprykerFormDependencyProvider
2. `isDevelopment` function call

The usage of `isDevelopment` checks is allowed in order to register the plugins that are needed in development mode only (e.g. profiling, debug, etc.).

```php
namespace Pyz\Zed\Console;

Expand All @@ -63,7 +63,7 @@ class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider
protected function getConsoleCommands(Container $container): array
{
$commands = [];

if ($this->getConfig()->isDevelopmentConsoleCommandsEnabled()) {
$commands[] = new CodeTestConsole();
}
Expand Down Expand Up @@ -113,9 +113,7 @@ class FormDependencyProvider extends SprykerFormDependencyProvider
}
```
### Resolving the error
To resolve the issue:
## Resole the error
1. Try to avoid the usage of conditions in the dependency providers.
2. Use only the supported expressions in the `if` construct.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ description: Reference information for evaluator tools.
template: howto-guide-template
---

The *Container set function* check checks the way plugins are registered in the dependency provider on the project level.
The *Container set function* check checks how plugins are registered in the dependency provider on the project level.

## Problem description

Inside of the dependency provider, you can add the plugin to `\Spryker\Client\Kernel\Container`, by using the `set` method.
To keep the plugins simple, please do not return an array of plugins inside the callback function.
When you need to register a list of plugins, please create a dedicated method for this purpose, return an array of plugins, and call this method inside the callable function.
In the dependency provider, you can add plugins to `\Spryker\Client\Kernel\Container` by using the `set` method. To keep the plugins simple, do not return arrays of plugins inside the callback function. When you need to register a list of plugins, create a dedicated method, return an array of plugins, and call this method inside the callable function.

## Example of an evaluator error message

Expand All @@ -25,7 +23,7 @@ Target: {PATH_TO_PROJECT}/Pyz/Zed/Checkout/CheckoutDependencyProvider.php:{LINE

## Example of code that causes an evaluator error

The method `addProductSalePageWidgetPlugins` in `ExampleDependencyProvider` contains the callable function that returns an array of plugins, it is not supported for now.
The method `addProductSalePageWidgetPlugins` in `ExampleDependencyProvider` contains a callable function that returns an array of plugins.

```php
namespace Pyz\Zed\ContainerSetFunctionChecker;
Expand Down Expand Up @@ -53,11 +51,9 @@ class ExampleDependencyProvider
}
```
### Resolving the error
## Resolve the error
To resolve the issue:
1. Create dedicated method for registering plugins.
1. Create a dedicated method for registering plugins.
2. Call the method in the callback function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class SinglePlugin extends SprykerSinglePlugin
}
```

### Resolving the error
## Resolve the error

To resolve the error:

1. Remove the unused dead code in project.
Remove the unused dead code in project.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ The following is an example of the `composer.json` file when the used Spryker fe
}
```

### Resolving the error
## Resolving the error

To resolve this issue:

1. Update the outdated dependencies to make it correspond to the minimum required version.
Update the outdated dependencies to make it correspond to the minimum required version.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class ModuleDependencyProvider extends SprykerModuleDependencyProvider
}
```
### Resolving the error
## Resolving the error
To resolve the error:
1. Try to have simple configuration arrays. They shouldn't have more than two nesting levels inside.
Try to have simple configuration arrays. They shouldn't have more than two nesting levels inside.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ By using the npm vulnerabilities checker with the Evaluator, developers can safe
NPM CHECKER
===========

Message: [critical] Prototype pollution in webpack loader-utils
Message: [critical] Prototype pollution in webpack loader-utils
https://github.com/advisories/GHSA-76p3-8jx3-jpfq
Target: loader-utils

Expand All @@ -36,6 +36,6 @@ Message: [high] Cross-realm object access in Webpack 5
Read more: https://docs.spryker.com/docs/scos/dev/guidelines/keeping-a-project-upgradable/upgradability-guidelines/npm-checker.html
```

### Resolving the issue
## Resolve the error

To resolve the issue, update the npm dependencies with known vulnerabilities to the versions where the vulnerability issues are fixed.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Your `composer.lock` file contains package versions that have security issues:
...
````

### Resolving the error
## Resolve the error

To resolve the error:
1. Upgrade the package to a version where the vulnerability issue is fixed.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ image:

Inconsistent PHP versions produce the error message output.

### Resolving the error
## Resolve the error

To resolve the issue:
1. Use a supported [Spryker SDK](https://docs.spryker.com/docs/sdk/dev/spryker-sdk.html) PHP version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class CategoryDependencyProvider extends SprykerDependencyProvider
}
```

### Resolving the error
## Resolve the error

To solve this issue:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ConsoleDependencyProvider
}
```

### Resolving the error
## Resolve the error

To resolve the error:
1. Refactor the plugin - remove the usage of the complicated constructor arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ Your `composer.lock` file contains package versions that have security issues:
...
````

### Resolving the error
## Resolve the error
To resolve the error, upgrade the package to a version where the vulnerability issue is fixed.

0 comments on commit 73ac4b5

Please sign in to comment.