inklabs/kommerce-core

View on GitHub

Showing 254 of 254 total issues

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

<?php
namespace inklabs\kommerce\ActionResponse\User;

use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\UserDTOBuilder;
Severity: Major
Found in src/ActionResponse/User/ListUsersResponse.php and 3 other locations - About 1 hr to fix
src/ActionResponse/Option/ListOptionsResponse.php on lines 1..44
src/ActionResponse/Product/ListProductsResponse.php on lines 1..44
src/ActionResponse/Tag/ListTagsResponse.php on lines 1..44

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 115.

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 5 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Shipment;

use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\ShipmentTrackerDTOBuilder;
Severity: Major
Found in src/ActionResponse/Shipment/ListAdHocShipmentsResponse.php and 4 other locations - About 1 hr to fix
src/ActionResponse/Attribute/ListAttributesResponse.php on lines 1..44
src/ActionResponse/CartPriceRule/ListCartPriceRulesResponse.php on lines 1..44
src/ActionResponse/Coupon/ListCouponsResponse.php on lines 1..44
src/ActionResponse/Warehouse/ListWarehousesResponse.php on lines 1..44

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 115.

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 5 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Warehouse;

use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\WarehouseDTOBuilder;
Severity: Major
Found in src/ActionResponse/Warehouse/ListWarehousesResponse.php and 4 other locations - About 1 hr to fix
src/ActionResponse/Attribute/ListAttributesResponse.php on lines 1..44
src/ActionResponse/CartPriceRule/ListCartPriceRulesResponse.php on lines 1..44
src/ActionResponse/Coupon/ListCouponsResponse.php on lines 1..44
src/ActionResponse/Shipment/ListAdHocShipmentsResponse.php on lines 1..44

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 115.

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 4 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Product;

use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\ProductDTOBuilder;
Severity: Major
Found in src/ActionResponse/Product/ListProductsResponse.php and 3 other locations - About 1 hr to fix
src/ActionResponse/Option/ListOptionsResponse.php on lines 1..44
src/ActionResponse/Tag/ListTagsResponse.php on lines 1..44
src/ActionResponse/User/ListUsersResponse.php on lines 1..44

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 115.

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 5 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Attribute;

use inklabs\kommerce\EntityDTO\Builder\AttributeDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
Severity: Major
Found in src/ActionResponse/Attribute/ListAttributesResponse.php and 4 other locations - About 1 hr to fix
src/ActionResponse/CartPriceRule/ListCartPriceRulesResponse.php on lines 1..44
src/ActionResponse/Coupon/ListCouponsResponse.php on lines 1..44
src/ActionResponse/Shipment/ListAdHocShipmentsResponse.php on lines 1..44
src/ActionResponse/Warehouse/ListWarehousesResponse.php on lines 1..44

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 115.

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 5 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\CartPriceRule;

use inklabs\kommerce\EntityDTO\Builder\CartPriceRuleDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
src/ActionResponse/Attribute/ListAttributesResponse.php on lines 1..44
src/ActionResponse/Coupon/ListCouponsResponse.php on lines 1..44
src/ActionResponse/Shipment/ListAdHocShipmentsResponse.php on lines 1..44
src/ActionResponse/Warehouse/ListWarehousesResponse.php on lines 1..44

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 115.

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 5 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Coupon;

use inklabs\kommerce\EntityDTO\Builder\CouponDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
Severity: Major
Found in src/ActionResponse/Coupon/ListCouponsResponse.php and 4 other locations - About 1 hr to fix
src/ActionResponse/Attribute/ListAttributesResponse.php on lines 1..44
src/ActionResponse/CartPriceRule/ListCartPriceRulesResponse.php on lines 1..44
src/ActionResponse/Shipment/ListAdHocShipmentsResponse.php on lines 1..44
src/ActionResponse/Warehouse/ListWarehousesResponse.php on lines 1..44

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 115.

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 4 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Tag;

use inklabs\kommerce\EntityDTO\Builder\PaginationDTOBuilder;
use inklabs\kommerce\EntityDTO\Builder\TagDTOBuilder;
Severity: Major
Found in src/ActionResponse/Tag/ListTagsResponse.php and 3 other locations - About 1 hr to fix
src/ActionResponse/Option/ListOptionsResponse.php on lines 1..44
src/ActionResponse/Product/ListProductsResponse.php on lines 1..44
src/ActionResponse/User/ListUsersResponse.php on lines 1..44

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 115.

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 4 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Attachment;

use inklabs\kommerce\Action\Attachment\MarkAttachmentNotVisibleCommand;
use inklabs\kommerce\EntityRepository\AttachmentRepositoryInterface;
src/ActionHandler/Attachment/MarkAttachmentLockedHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentUnlockedHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentVisibleHandler.php on lines 1..39

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 114.

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 4 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Attachment;

use inklabs\kommerce\Action\Attachment\MarkAttachmentVisibleCommand;
use inklabs\kommerce\EntityRepository\AttachmentRepositoryInterface;
src/ActionHandler/Attachment/MarkAttachmentLockedHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentNotVisibleHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentUnlockedHandler.php on lines 1..39

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 114.

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 4 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Attachment;

use inklabs\kommerce\Action\Attachment\MarkAttachmentLockedCommand;
use inklabs\kommerce\EntityRepository\AttachmentRepositoryInterface;
src/ActionHandler/Attachment/MarkAttachmentNotVisibleHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentUnlockedHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentVisibleHandler.php on lines 1..39

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 114.

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 4 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Attachment;

use inklabs\kommerce\Action\Attachment\MarkAttachmentUnlockedCommand;
use inklabs\kommerce\EntityRepository\AttachmentRepositoryInterface;
src/ActionHandler/Attachment/MarkAttachmentLockedHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentNotVisibleHandler.php on lines 1..39
src/ActionHandler/Attachment/MarkAttachmentVisibleHandler.php on lines 1..39

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 114.

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

Method loadValidatorMetadata has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function loadValidatorMetadata(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraint('firstName', new Assert\Length([
            'max' => 32,
        ]));
Severity: Minor
Found in src/Entity/OrderAddress.php - About 1 hr to fix

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

            string $code,
            bool $flagFreeShipping,
            ?int $minOrderValue,
            ?int $maxOrderValue,
            bool $canCombineWithOtherCoupons,
    Severity: Major
    Found in src/Action/Coupon/AbstractCouponCommand.php - About 1 hr to fix

      Function import has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function import(Iterator $iterator): ImportResult
          {
              $importResult = new ImportResult;
              foreach ($iterator as $key => $row) {
                  if ($key < 2 && $row[0] === 'order_ref') {
      Severity: Minor
      Found in src/Service/Import/ImportOrderItemService.php - About 1 hr 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

      Method import has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function import(Iterator $iterator): ImportResult
          {
              $importResult = new ImportResult;
              foreach ($iterator as $key => $row) {
                  if ($key < 2 && $row[0] === 'order_ref') {
      Severity: Minor
      Found in src/Service/Import/ImportOrderItemService.php - About 1 hr to fix

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

                string $code,
                bool $flagFreeShipping,
                ?int $minOrderValue,
                ?int $maxOrderValue,
                bool $canCombineWithOtherCoupons,
        Severity: Major
        Found in src/Action/Coupon/CreateCouponCommand.php - About 1 hr to fix

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

                  string $name,
                  string $attention,
                  string $company,
                  string $address1,
                  string $address2,
          Severity: Major
          Found in src/Action/Warehouse/AbstractWarehouseCommand.php - About 1 hr to fix

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

                    CartRepositoryInterface $cartRepository,
                    CouponRepositoryInterface $couponRepository,
                    EventDispatcherInterface $eventDispatcher,
                    OptionProductRepositoryInterface $optionProductRepository,
                    OptionValueRepositoryInterface $optionValueRepository,
            Severity: Major
            Found in src/Service/CartService.php - About 1 hr to fix

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

                  public function getAllCatalogPromotions(string $queryString = null, Pagination & $pagination = null)
                  {
                      $query = $this->getQueryBuilder()
                          ->select('CatalogPromotion')
                          ->from(CatalogPromotion::class, 'CatalogPromotion');
              Severity: Major
              Found in src/EntityRepository/CatalogPromotionRepository.php and 2 other locations - About 1 hr to fix
              src/EntityRepository/CartPriceRuleRepository.php on lines 9..25
              src/EntityRepository/UserLoginRepository.php on lines 21..37

              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 110.

              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

              Severity
              Category
              Status
              Source
              Language