EmicoEcommerce/Magento2Tweakwise

View on GitHub

Showing 71 of 90 total issues

Config has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

class Config
{
    /**
     * Recommendation types
     */
Severity: Minor
Found in Model/Config.php - About 4 hrs to fix

    Filter has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Filter extends AbstractFilter implements FilterInterface
    {
        /**
         * @var string
         */
    Severity: Minor
    Found in Model/Catalog/Layer/Filter.php - About 4 hrs to fix

      File PathSlugStrategy.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Tweakwise & Emico (https://www.tweakwise.com/ & https://www.emico.nl/) - All Rights Reserved
       *
       * @copyright Copyright (c) 2017-2019 Tweakwise.com B.V. (https://www.tweakwise.com)
      Severity: Minor
      Found in Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php - About 3 hrs to fix

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

                CollectionEntityFactory $entityFactory,
                LoggerInterface $logger,
                FetchStrategyInterface $fetchStrategy,
                ManagerInterface $eventManager,
                EavConfig $eavConfig,
        Severity: Major
        Found in Model/Catalog/Product/Recommendation/Collection.php - About 2 hrs to fix

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

                  CollectionEntityFactory $entityFactory,
                  LoggerInterface $logger,
                  FetchStrategyInterface $fetchStrategy,
                  ManagerInterface $eventManager,
                  EavConfig $eavConfig,
          Severity: Major
          Found in Model/Catalog/Product/Collection.php - About 2 hrs to fix

            File Filter.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Tweakwise & Emico (https://www.tweakwise.com/ & https://www.emico.nl/) - All Rights Reserved
             *
             * @copyright Copyright (c) 2017-2017 Tweakwise.com B.V. (https://www.tweakwise.com)
            Severity: Minor
            Found in Model/Catalog/Layer/Filter.php - About 2 hrs to fix

              Function _updateBlocks has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _updateBlocks: function (htmlResponse) {
                          var filterSelector = this.options.filterSelector;
                          var productListSelector = this.options.productListSelector;
                          var toolbarSelector = this.options.toolbarSelector;
              
              
              Severity: Major
              Found in view/frontend/web/js/navigation-form.js - About 2 hrs to fix

                File QueryParameterStrategy.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Tweakwise & Emico (https://www.tweakwise.com/ & https://www.emico.nl/) - All Rights Reserved
                 *
                 * @copyright Copyright (c) 2017-2019 Tweakwise.com B.V. (https://www.tweakwise.com)
                Severity: Minor
                Found in Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php - About 2 hrs to fix

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

                          ConfigInterface $routeConfig,
                          RequestInterface $request,
                          SecurityInfoInterface $urlSecurityInfo,
                          ScopeResolverInterface $scopeResolver,
                          Generic $session,
                  Severity: Major
                  Found in Model/Catalog/Layer/Url/UrlModel.php - About 2 hrs to fix

                    Function apply has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function apply(MagentoHttpRequest $request, ProductNavigationRequest $navigationRequest): FilterApplierInterface
                        {
                            $attributeFilters = $this->getAttributeFilters($request);
                            foreach ($attributeFilters as $attribute => $values) {
                                if (!is_array($values)) {
                    Severity: Minor
                    Found in Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.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 getSwatchData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getSwatchData()
                        {
                            if (false === $this->eavAttribute instanceof Attribute) {
                                throw new \RuntimeException('Magento_Swatches: RenderLayered: Attribute has not been set.');
                            }
                    Severity: Minor
                    Found in Block/LayeredNavigation/RenderLayered/SwatchRenderer.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 upgrade has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
                        {
                            $installer = $setup;
                            $installer->startSetup();
                            if (version_compare($context->getVersion(), '2.0.0') >= 0) {
                    Severity: Minor
                    Found in Setup/UpgradeSchema.php - About 1 hr to fix

                      Method apply has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function apply(MagentoHttpRequest $request, ProductNavigationRequest $navigationRequest): FilterApplierInterface
                          {
                              $attributeFilters = $this->getAttributeFilters($request);
                              foreach ($attributeFilters as $attribute => $values) {
                                  if (!is_array($values)) {
                      Severity: Minor
                      Found in Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php - About 1 hr to fix

                        Method getSwatchData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getSwatchData()
                            {
                                if (false === $this->eavAttribute instanceof Attribute) {
                                    throw new \RuntimeException('Magento_Swatches: RenderLayered: Attribute has not been set.');
                                }
                        Severity: Minor
                        Found in Block/LayeredNavigation/RenderLayered/SwatchRenderer.php - About 1 hr to fix

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

                                  View\Element\Template\Context $context,
                                  View\LayoutFactory $layoutFactory,
                                  View\Layout\ReaderPool $layoutReaderPool,
                                  Framework\Translate\InlineInterface $translateInline,
                                  View\Layout\BuilderFactory $layoutBuilderFactory,
                          Severity: Major
                          Found in Model/AjaxNavigationResult.php - About 1 hr to fix

                            Method apply has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function apply()
                                {
                                    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
                            
                                    $eavSetup->addAttribute(
                            Severity: Minor
                            Found in Setup/Patch/Data/AddFilterAndFilterValuesCategoryAttribute.php - About 1 hr to fix

                              Method initFilters has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function initFilters(Layer $layer)
                                  {
                                      $request = $this->context->getRequest();
                                      if (!$request->hasParameter('tn_cid')) {
                                          $request->addCategoryFilter($layer->getCurrentCategory());
                              Severity: Minor
                              Found in Model/Catalog/Layer/FilterList/Tweakwise.php - About 1 hr to fix

                                Method handleRequestSuccess has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function handleRequestSuccess(
                                        ResponseInterface $httpResponse,
                                        HttpRequest $httpRequest,
                                        Request $tweakwiseRequest,
                                        float $start
                                Severity: Minor
                                Found in Model/Client.php - About 1 hr to fix

                                  Function prepareFieldsMeta has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function prepareFieldsMeta($fieldsMap, $fieldsMeta)
                                      {
                                          $canEditDesign = $this->auth->isAllowed('Magento_Catalog::edit_category_design');
                                  
                                          $result = [];
                                  Severity: Minor
                                  Found in Model/Category/DataProvider/Plugin.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 11 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          UrlModel $magentoUrl,
                                          UrlFactory $urlFactory,
                                          Resolver $layerResolver,
                                          FilterSlugManager $filterSlugManager,
                                          QueryParameterStrategy $queryParameterStrategy,
                                  Severity: Major
                                  Found in Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language