Skip to content

Commit

Permalink
Merge branch 'master' into feature/cc-16486-update-product-rating-and…
Browse files Browse the repository at this point in the history
…-review-ig
  • Loading branch information
ievgen-malykhin committed Jul 18, 2023
2 parents e1b7e53 + 7f99c8c commit 2fd094e
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,20 @@ Here is an example of product data stored in Algolia:
{
"sku": "017_21748906",
"name": "Sony Cyber-shot DSC-W800",
"abstract_name": "Sony Cyber-shot DSC-W800",
"description": "Styled for your pocket Precision photography meets the portability of a smartphone. The W800 is small enough to take great photos, look good while doing it, and slip in your pocket. Shooting great photos and videos is easy with the W800. Buttons are positioned for ease of use, while a dedicated movie button makes shooting movies simple. The vivid 2.7-type Clear Photo LCD display screen lets you view your stills and play back movies with minimal effort. Whip out the W800 to capture crisp, smooth footage in an instant. At the press of a button, you can record blur-free 720 HD images with digital sound. Breathe new life into a picture by using built-in Picture Effect technology. There’s a range of modes to choose from – you don’t even have to download image-editing software.",
"url": "/en/sony-cyber-shot-dsc-w800-17",
"product_abstract_sku": "017",
"rating": 4.5,
"keywords": "Sony,Entertainment Electronics",
"image": "https://images.icecat.biz/img/norm/high/21748906-Sony.jpg",
"images": {
"default": [
{
"small": "https://images.icecat.biz/img/norm/medium/21748906-Sony.jpg",
"large": "https://images.icecat.biz/img/norm/high/21748906-Sony.jpg"
}
]
},
"category": [
"Demoshop",
"Cameras & Camcorders",
Expand All @@ -90,18 +98,33 @@ Here is an example of product data stored in Algolia:
"upcs": "0013803252897",
"usb_version": "2"
},
"merchants": [ // Marketplace only
"Video King1",
"merchant_name": [ // Marketplace only
"Video King",
"Budget Cameras"
],
"merchant_reference": [ // Marketplace only
"MER000002",
"MER000005"
],
"search_metadata": [], // Put inside this list all your ranking attributes
"concrete_prices": {
"eur": {
"gross": 345699,
"net": 311129
},
"chf": {
"gross": 397554,
"net": 357798
}
},
"prices": {
"eur": {
"gross": 276559,
"net": 248903
"gross": 345699,
"net": 311129
},
"chf": {
"gross": 318043,
"net": 286238
"gross": 397554,
"net": 357798
}
},
"objectID": "017_21748906"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,19 @@ class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider
}
```

## Example of an Evaluator error message
## Example of an evaluator error message

```bash
======================
MULTIDIMENSIONAL ARRAY
======================

+---+------------------------------------------------------------------------------------+-------------------------------------------------------------------+
| # | Message | Target |
+---+------------------------------------------------------------------------------------+-------------------------------------------------------------------+
| 1 | The condition statement if ($alwaysTrue) {} is forbidden in the DependencyProvider | <path_to_project>/Pyz/Zed/Checkout/CheckoutDependencyProvider.php |
+---+------------------------------------------------------------------------------------+-------------------------------------------------------------------+
Message: The if ($alwaysTrue) {} condition statement is forbidden in DependencyProvider
Target: {PATH_TO_PROJECT}/Pyz/Zed/Checkout/CheckoutDependencyProvider.php

```
## Example of code that causes an upgradability error
## Example of code that causes an evaluator error
The method `getFormPlugins` in `FormDependencyProvider` contains unsupported expressions in the `if` construct `$alwaysAddPlugin`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ This results in unnecessary additional time investment from developers, as they
This check examines potential obsolete classes, with a tendency to overlook important Spryker kernel classes like `Factory`, `Facade`, or `DependencyProvider`.
If desired, you have the option to disable the dead code checker for a particular class using the `@evaluator-skip-dead-code` annotation.

## Example of an Evaluator error message
## Example of an evaluator error message

```bash
=================
DEAD CODE CHECKER
=================

+---+---------------------------------------------------------------------------------+--------------------------------------------------+
| # | Message | Target |
+---+---------------------------------------------------------------------------------+--------------------------------------------------+
| 1 | Class "Pyz/Zed/Single/Communication/Plugin/SinglePlugin" is not used in project | Pyz/Zed/Single/Communication/Plugin/SinglePlugin |
+---+---------------------------------------------------------------------------------+--------------------------------------------------+
Message: The class "Pyz/Zed/Single/Communication/Plugin/SinglePlugin" is not used in the project.
Target: Pyz/Zed/Single/Communication/Plugin/SinglePlugin
```

## Example of code that causes an evaluator error

Unused class `Pyz/Zed/Single/Communication/Plugin/SinglePlugin` that produces an error:

```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To enable smooth upgradability of the project using the [Spryker Code Upgrader](

In case the project does not utilize the feature packages, it is necessary to ensure that the corresponding Spryker module versions are used.

## Example of an Evaluator error message
## Example of an evaluator error message

Below is an example of when a used feature package version doesn't correspond to the minimum required version:

Expand All @@ -28,18 +28,17 @@ MINIMUM ALLOWED SHOP VERSION
+---+---------------------------------------------------------------------------------------------------------------------------+---------------------------------------+
```

Below is an example of when the used Spryker package version doesn't correspond to the minimum required version:
## Example of code that causes an evaluator error

The following is an example of when the used Spryker package version doesn't correspond to the minimum required version:

```shell
============================
MINIMUM ALLOWED SHOP VERSION
============================

+---+-----------------------------------------------------------------------------------------------------------------+--------------------------------+
| # | Message | Target |
+---+-----------------------------------------------------------------------------------------------------------------+--------------------------------+
| 1 | The package "spryker/availability-gui" version "6.5.9" is not supported. The minimum allowed version is "6.6.0" | spryker/availability-gui:6.5.9 |
+---+-----------------------------------------------------------------------------------------------------------------+--------------------------------+
Message: The package "spryker/availability-gui" version 6.5.9 is not supported. The minimum allowed version is 6.6.0.
Target: spryker/availability-gui:6.5.9
```

### Resolving the error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,19 @@ This check checks that project doesn't use the deeply nested multidimensional ar
If a plugins stack is used on the project level, not all structures are necessarily required. Deeply nested multidimensional arrays make configuration hard to upgrade.
This check verifies that multidimensional arrays have a maximum of two levels of nesting inside.

## Example of an Evaluator error message
## Example of an evaluator error message

```bash
======================
MULTIDIMENSIONAL ARRAY
======================

+---+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| # | Message | Target |
+---+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| 1 | Reached max level of nesting for the plugin registration in the {FormDependencyProvider::getPlugins()}. | Pyz\Yves\Module\ModuleDependencyProvider |
| | The maximum allowed nesting level is 2. Please, refactor code, otherwise it will cause upgradability issues in the future. | |
+---+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------+

Message: Reached max level of nesting for the plugin registration in the {FormDependencyProvider::getPlugins()}.
The maximum allowed nesting level is 2. Refactor the code; otherwise, it can cause upgradability issues in the future.
Target: Pyz\Yves\Module\ModuleDependencyProvider
```
## Example of code that causes an upgradability error
## Example of code that causes an evaluator error
The methods `ModuleDependencyProvider` contains unsupported multidimensional arrays, which have more than two nesting levels inside.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ image:
...
```

## Example of an Evaluator error message
## Example of an evaluator error message

Below is an example of an unsupported [Spryker SDK](https://docs.spryker.com/docs/sdk/dev/spryker-sdk.html) PHP version being used in the `composer.json` file:

Expand All @@ -56,11 +56,8 @@ Below is an example of an unsupported [Spryker SDK](https://docs.spryker.com/doc
PHP VERSION CHECKER
===================

+---+------------------------------------------------------------------------+---------------------------------+
| # | Message | Target |
+---+------------------------------------------------------------------------+---------------------------------+
| 1 | Composer json PHP constraint "7.2" does not match allowed PHP versions | <path_to_project>/composer.json |
+---+------------------------------------------------------------------------+---------------------------------+
Message: Composer json PHP constraint 7.2 does not match allowed PHP versions.
Target: `{PATH_TO_PROJECT}/composer.json`
```

A `composer.json` file that produces the error message:
Expand All @@ -84,12 +81,9 @@ Below is an example of an unsupported [Spryker SDK](https://docs.spryker.com/doc
PHP VERSION CHECKER
===================

+---+-----------------------------------------------------------------------------------+------------------------------+
| # | Message | Target |
+---+-----------------------------------------------------------------------------------+------------------------------+
| 1 | The deploy file uses a not allowed PHP image version "spryker/php:7.2-alpine3.12" | <path_to_project>/deploy.yml |
| | The image tag must contain an allowed PHP version (image:abc-8.0) | |
+---+-----------------------------------------------------------------------------------+------------------------------+
Message: The deploy file uses a not allowed PHP image version "spryker/php:7.2-alpine3.12".
The image tag must contain an allowed PHP version (image:abc-8.0)
Target: {PATH_TO_PROJECT}/deploy.yml
```

A `deploy.yml` file that produces the error message:
Expand All @@ -112,14 +106,11 @@ Below is an example of inconsistent PHP versions being used in the `composer.jso
PHP VERSION CHECKER
===================

+---+--------------------------------------------+--------------------------------------------------------+
| # | Message | Target |
+---+--------------------------------------------+--------------------------------------------------------+
| 1 | Not all the targets have the same PHP versions | Current php version $phpVersion: php7.2 |
| | | tests/Acceptance/_data/InvalidProject/composer.json: - |
| | | tests/Acceptance/_data/InvalidProject/deploy**.yml: - |
| | | SDK php versions: php7.2, php8.2 |
+---+--------------------------------------------+--------------------------------------------------------+
Message: Not all the targets have the same PHP versions
Target: Current php version $phpVersion: php7.2
tests/Acceptance/_data/InvalidProject/composer.json: -
tests/Acceptance/_data/InvalidProject/deploy**.yml: -
SDK php versions: php7.2, php8.2
```

The `composer.json` file uses PHP version `7.2`:
Expand Down Expand Up @@ -149,7 +140,7 @@ image:
...
```

Inconsistent PHP versions produces the error message output.
Inconsistent PHP versions produce the error message output.

### Resolving the error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,18 @@ Below is an example of the annotation syntax needed to register a plugin only af
new DefaultProductOfferReferenceStrategyPlugin(),
```

## Example of an Evaluator error message
## Example of an evaluator error message

```shell
==============================================
PLUGINS REGISTRATION WITH RESTRICTIONS CHECKER
==============================================

+---+------------------------------------------------------------------------------------------------------+--------------------------------+
| # | Message | Target |
+---+------------------------------------------------------------------------------------------------------+--------------------------------+
| 1 | Restriction rule does not match the pattern "/^\* - (before|after) \{@link (?<class>.+)\}( .*\.|)$/" | CategoryDependencyProvider.php |
+---+------------------------------------------------------------------------------------------------------+--------------------------------+
Message: Restriction rule does not match the pattern "/^\* - (before|after) \{@link (?<class>.+)\}( .*\.|)$/".
Target: CategoryDependencyProvider.php
```

## Example of code that causes an upgradability error
## Example of code that causes an evaluator error

```php
namespace Pyz\Zed\Category;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@ Security Checker is a tool that checks if your PHP application depends on PHP pa

A project can sometimes use dependencies that contain known vulnerabilities.. To minimize the security risk for the project, such dependencies should be updated to the version that has the vulnerability fixed.

## Example of an Evaluator error message
## Example of an evaluator error message

```bash
================
SECURITY CHECKER
================

+---+---------------------------------------------------------------------------------------------------------------------+-----------------------+
| # | Message | Target |
+---+---------------------------------------------------------------------------------------------------------------------+-----------------------+
| 1 | Improper header validation (CVE-2023-29197): https://github.com/guzzle/psr7/security/advisories/GHSA-wxmh-65f7-jcvw | guzzlehttp/psr7:2.4.1 |
+---+---------------------------------------------------------------------------------------------------------------------+-----------------------+
Message: Improper header validation (CVE-2023-29197): https://github.com/guzzle/psr7/security/advisories/GHSA-wxmh-65f7-jcvw
Target: guzzlehttp/psr7:2.4.1
```

## Example of code that causes an upgradability error
## Example of code that causes an evaluator error

Your `composer.lock` file contains package versions that have security issues:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description: Reference information for evaluator tools.
template: howto-guide-template
---

This check makes sure that the plugins don't require the complicated constructor arguments.
This check makes sure that the plugins don't require complicated constructor arguments.

## Problem description

Inside of the dependency provider you can register the plugin directly in the method or through another wrap method, with and without constructor arguments.
Inside of the dependency provider, you can register the plugin directly in the method or through another wrap method, with and without constructor arguments.
To keep the plugins simple, they shouldn't require complicated objects as constructor arguments.

Supported argument types:
Expand All @@ -22,23 +22,20 @@ Supported argument types:
## Example of evaluator error message

```bash
================
======================
SINGLE PLUGIN ARGUMENT
================

+---+-------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| # | Message | Target |
+---+-------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| 1 | Plugin \Spryker\Zed\Console\Communication\Plugin\MonitoringConsolePlugin | |
| | should not have unsupported constructor parameters. | <path_to_class>\ConsoleDependencyProvider::getMonitoringConsoleMethod |
| | Supported argument types: int, float, string, const, bool, int, usage of new statement to | |
| | instantiate a class (without further methods calls) | |
+---+-------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
======================

Message: The "\Spryker\Zed\Console\Communication\Plugin\MonitoringConsolePlugin" plugin
should not have unsupported constructor parameters.
Supported argument types: int, float, string, const, bool, int, usage of new statement to
instantiate a class (without further methods calls).
Target: {PATH_TO_PROJECT}\ConsoleDependencyProvider::getMonitoringConsoleMethod()
```

## Example of code that causes an upgradability error
## Example of code that causes an evaluator error

The dependency provider method returns the plugin with unwanted argument:
The dependency provider method returns the plugin with the unwanted argument:

```bash
namespace Pyz\Zed\SinglePluginArgument;
Expand All @@ -62,5 +59,5 @@ class ConsoleDependencyProvider
### Resolving the error

To resolve the error:
1. Rework the plugin - remove the usage of the complicated constructor arguments.
1. Refactor the plugin - remove the usage of the complicated constructor arguments.

Loading

0 comments on commit 2fd094e

Please sign in to comment.