EmicoEcommerce/Magento2TweakwiseExport

View on GitHub

Showing 111 of 111 total issues

Method exportStore has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function exportStore(Writer $writer, XMLWriter $xml, Store $store, array $entityIds = []): void
    {
        // Set root category as exported
        $exportedCategories = [1 => true];
        $storeId = $store->getId();
Severity: Minor
Found in Model/Write/Categories.php - About 1 hr to fix

    Method loopUnionRows has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function loopUnionRows(MysqlStatement $stmt)
        {
            $entity = ['entity_id' => null];
            while ($row = $stmt->fetch()) {
                $attributeId = $row['attribute_id'];
    Severity: Minor
    Found in Model/Write/EavIterator.php - About 1 hr to fix

      Method setFromArray has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setFromArray(array $data): void
          {
              foreach ($data as $key => $value) {
                  switch ($key) {
                      case 'entity_id':
      Severity: Minor
      Found in Model/Write/Products/ExportEntity.php - About 1 hr to fix

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

            public function getAttribute(string $attribute, bool $asArray = true)
            {
                if (!isset($this->attributes[$attribute])) {
                    throw new InvalidArgumentException(sprintf('Could not find attribute %s', $attribute));
                }
        Severity: Major
        Found in Model/Write/Stock/ExportEntity.php and 2 other locations - About 1 hr to fix
        Model/Write/Price/ExportEntity.php on lines 258..269
        Model/Write/Products/ExportEntity.php on lines 286..297

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

        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

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

            public function getAttribute(string $attribute, bool $asArray = true)
            {
                if (!isset($this->attributes[$attribute])) {
                    throw new InvalidArgumentException(sprintf('Could not find attribute %s', $attribute));
                }
        Severity: Major
        Found in Model/Write/Products/ExportEntity.php and 2 other locations - About 1 hr to fix
        Model/Write/Price/ExportEntity.php on lines 258..269
        Model/Write/Stock/ExportEntity.php on lines 258..269

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

        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

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

            public function getAttribute(string $attribute, bool $asArray = true)
            {
                if (!isset($this->attributes[$attribute])) {
                    throw new InvalidArgumentException(sprintf('Could not find attribute %s', $attribute));
                }
        Severity: Major
        Found in Model/Write/Price/ExportEntity.php and 2 other locations - About 1 hr to fix
        Model/Write/Products/ExportEntity.php on lines 286..297
        Model/Write/Stock/ExportEntity.php on lines 258..269

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

        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 __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                Helper $helper,
                EavConfig $eavConfig,
                DbContext $dbContext,
                Manager $eventManager,
                ExportEntityFactory $entityFactory,
        Severity: Major
        Found in Model/Write/Products/Iterator.php - About 1 hr to fix

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

                  Helper $helper,
                  EavConfig $eavConfig,
                  DbContext $dbContext,
                  Manager $eventManager,
                  ExportEntityFactory $entityFactory,
          Severity: Major
          Found in Model/Write/Price/Iterator.php - About 1 hr to fix

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

                    Helper $helper,
                    EavConfig $eavConfig,
                    DbContext $dbContext,
                    Manager $eventManager,
                    ExportEntityFactory $entityFactory,
            Severity: Major
            Found in Model/Write/Stock/Iterator.php - About 1 hr to fix

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

                  public function getIterator(): \Traversable
                  {
                      while ($entityIds = $this->getEntityBatch()) {
                          try {
                              Profiler::start('eav-iterator::' . $this->entityCode);
              Severity: Minor
              Found in Model/Write/EavIterator.php - About 1 hr to fix

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

                    protected function scalarValue($value)
                    {
                        if (is_array($value)) {
                            $data = [];
                            foreach ($value as $key => $childValue) {
                Severity: Minor
                Found in Model/Write/Products.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

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

                    protected function scalarValue($value)
                    {
                        if (is_array($value)) {
                            $data = [];
                            foreach ($value as $key => $childValue) {
                Severity: Minor
                Found in Model/Write/Stock.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

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

                    public function getIterator(): \Traversable
                    {
                        $batch = $this->collectionFactory->create(['store' => $this->store]);
                        foreach (parent::getIterator() as $entityData) {
                            $entity = $this->entityFactory->create(
                Severity: Minor
                Found in Model/Write/Products/Iterator.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

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

                    protected function scalarValue($value)
                    {
                        if (is_array($value)) {
                            $data = [];
                            foreach ($value as $key => $childValue) {
                Severity: Minor
                Found in Model/Write/Price.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

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

                    public function getIterator(): \Traversable
                    {
                        $batch = $this->collectionFactory->create(['store' => $this->store]);
                        foreach (parent::getIterator() as $entityData) {
                            $entity = $this->entityFactory->create(
                Severity: Minor
                Found in Model/Write/Stock/Iterator.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

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

                    public function getIterator(): \Traversable
                    {
                        $batch = $this->collectionFactory->create(['store' => $this->store]);
                        foreach (parent::getIterator() as $entityData) {
                            $entity = $this->entityFactory->create(
                Severity: Minor
                Found in Model/Write/Price/Iterator.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 getStockItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getStockItem(): ?StockItem
                    {
                        if ($this->isStockCombined) {
                            return $this->stockItem;
                        }
                Severity: Minor
                Found in Traits/Stock/HasStockThroughChildren.php - About 1 hr to fix

                  Method getAttributeSelectEnterprise has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function getAttributeSelectEnterprise(string $table, array $attributes): Select
                      {
                          $connection = $this->getConnection();
                          $select = $connection->select()
                              ->from(['attribute_table' => $table], [])
                  Severity: Minor
                  Found in Model/Write/EavIterator.php - About 1 hr to fix

                    Method setFromArray has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function setFromArray(array $data): void
                        {
                            foreach ($data as $key => $value) {
                                switch ($key) {
                                    case 'entity_id':
                    Severity: Minor
                    Found in Model/Write/Stock/ExportEntity.php - About 1 hr to fix

                      Method setFromArray has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function setFromArray(array $data): void
                          {
                              foreach ($data as $key => $value) {
                                  switch ($key) {
                                      case 'entity_id':
                      Severity: Minor
                      Found in Model/Write/Price/ExportEntity.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language