inklabs/kommerce-core

View on GitHub

Showing 84 of 254 total issues

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 $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

        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 import has 36 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/ImportOrderService.php - About 1 hr to fix

            Function import has a Cognitive Complexity of 12 (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/ImportOrderService.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 loadValidatorMetadata has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

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

                Method import has 32 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] === 'id') {
                Severity: Minor
                Found in src/Service/Import/ImportUserService.php - About 1 hr to fix

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

                      public static function loadValidatorMetadata(ClassMetadata $metadata)
                      {
                          $metadata->addPropertyConstraint('externalId', new Assert\NotBlank);
                          $metadata->addPropertyConstraint('externalId', new Assert\Length([
                              'max' => 255,
                  Severity: Minor
                  Found in src/Lib/PaymentGateway/ChargeResponse.php - About 1 hr to fix

                    Function loadOptionsFromTags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function loadOptionsFromTags()
                        {
                            $options = new ArrayCollection();
                            $textOptions = new ArrayCollection();
                            foreach ($this->entityDTO->tags as $tag) {
                    Severity: Minor
                    Found in src/EntityDTO/Builder/ProductDTOBuilder.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 __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct(ShipmentRate $shipmentRate, DTOBuilderFactoryInterface $dtoBuilderFactory)
                        {
                            $this->entity = $shipmentRate;
                            $this->dtoBuilderFactory = $dtoBuilderFactory;
                    
                    
                    Severity: Minor
                    Found in src/EntityDTO/Builder/ShipmentRateDTOBuilder.php - About 1 hr to fix

                      Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function __construct(Cart $cart, DTOBuilderFactoryInterface $dtoBuilderFactory)
                          {
                              $this->entity = $cart;
                              $this->dtoBuilderFactory = $dtoBuilderFactory;
                      
                      
                      Severity: Minor
                      Found in src/EntityDTO/Builder/CartDTOBuilder.php - About 1 hr to fix

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

                                int $promotionTypeId,
                                int $value,
                                bool $reducesTaxSubtotal,
                                ?int $maxRedemptions,
                                DateTime $startDate,
                        Severity: Major
                        Found in src/Action/Product/CreateProductQuantityDiscountCommand.php - About 1 hr to fix

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

                                  string $name,
                                  string $promotionTypeSlug,
                                  int $value,
                                  bool $reducesTaxSubtotal,
                                  ?int $maxRedemptions,
                          Severity: Major
                          Found in src/Action/CatalogPromotion/AbstractCatalogPromotionCommand.php - About 1 hr to fix

                            Method import has 28 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/ImportPaymentService.php - About 1 hr to fix

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

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

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

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

                                  Function calculateCartPriceRules has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function calculateCartPriceRules(): void
                                      {
                                          foreach ($this->pricing->getCartPriceRules() as $cartPriceRule) {
                                              if ($cartPriceRule->isValid($this->pricing->getDate(), $this->cart->getCartItems())) {
                                                  $numberTimesToApply = $cartPriceRule->numberTimesToApply($this->cart->getCartItems());
                                  Severity: Minor
                                  Found in src/Lib/CartCalculator.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language