EmicoEcommerce/Magento2Tweakwise

View on GitHub

Showing 135 of 169 total issues

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

    protected function getCurrentQueryUrl(MagentoHttpRequest $request, array $query)
    {
        $selectedFilters = $request->getQuery();
        $reservedParams = [
            self::PARAM_LIMIT,
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 getFinalPrice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFinalPrice()
    {
        $attributes = $this->getDataValue('attributes');
        if (!empty($attributes['attribute'])) {
            foreach ($attributes['attribute'] as $attribute) {
Severity: Minor
Found in Model/Client/Type/ItemType.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 isFilterValueItemInWhiteList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function isFilterValueItemInWhiteList(Item $item): bool
    {
        $filterValuesWhiteList = $this->config->getFilterValuesWhitelist();
        $attributeValue = $this->getAttributeValueFromFilterItem($item);

Severity: Minor
Found in Model/Seo/FilterHelper.php - About 1 hr to fix

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

        public function getOriginalUrl(MagentoHttpRequest $request): string
        {
            $originalUrl = $request->getQuery('__tw_original_url');
            if ($originalUrl) {
                $urlArray = explode('/', $originalUrl);
    Severity: Minor
    Found in Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php - About 1 hr to fix

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

          public function execute()
          {
              $result = [];
              $json = $this->resultFactory->create('json');
              $facetRequest = $this->requestFactory->create();
      Severity: Minor
      Found in Controller/Ajax/Facets.php - About 1 hr to fix

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

            public function save(AttributeSlugInterface $attributeSlug): AttributeSlugInterface
            {
                try {
                    //check for existing slugs with the same slug
                    try {
        Severity: Minor
        Found in Model/AttributeSlugRepository.php - About 1 hr to fix

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

              private function getShoppingcartCrosssellItems(array $cartProductIds, array $result)
              {
                  $items = [];
          
                  if ($cartProductIds) {
          Severity: Minor
          Found in Block/Checkout/Cart/Crosssell/Plugin.php - About 1 hr to fix

            Function _handleFilterSearch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _handleFilterSearch: function () {
                        var filterInput = this.element.find('.tw_filtersearch');
                        var value = filterInput.val().toLowerCase().trim();
                        var items = filterInput.parent('div').find('ol');
                        var noItems = filterInput.parent('div').find('.search_no_results');
            Severity: Minor
            Found in view/frontend/web/js/navigation-sort.js - About 1 hr to fix

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

                  private function getShoppingcartCrosssellItems(array $cartProductIds, array $result)
                  {
                      $items = [];
              
                      if ($cartProductIds) {
              Severity: Minor
              Found in Block/Cart/Crosssell/Plugin.php - About 1 hr to fix

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

                        Config $config,
                        QueryFactory $queryFactory,
                        StoreManagerInterface $storeManager,
                        CategoryRepositoryInterface $categoryRepository,
                        HttpRequest $request,
                Severity: Major
                Found in Model/Autocomplete/DataProviderHelper.php - About 1 hr to fix

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

                          Config $config,
                          CookieManagerInterface $cookieManager,
                          DataProviderHelper $dataProviderHelper,
                          SuggestionGroupItemFactory $suggestionGroupItemFactory,
                          RequestFactory $productSuggestionRequestFactory,
                  Severity: Major
                  Found in Model/Autocomplete/DataProvider/SuggestionDataProvider.php - About 1 hr to fix

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

                            Config $config,
                            UrlInterface $url,
                            CurrentContext $currentNavigationContext,
                            ProductMetadataInterface $productMetadata,
                            FilterFormInputProviderInterface $filterFormInputProvider,
                    Severity: Major
                    Found in Model/NavigationConfig.php - About 1 hr to fix

                      Function aroundRender has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function aroundRender(FilterRenderer $subject, Closure $proceed, FilterInterface $filter)
                          {
                              if (!$filter instanceof Filter) {
                                  return $proceed($filter);
                              }
                      Severity: Minor
                      Found in Block/Navigation/FilterRenderer/Plugin.php - About 55 mins 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 getCollection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getCollection(Category $category)
                          {
                              if (!$this->config->isLayeredEnabled()) {
                                  if (
                                      !$this->config->isSearchEnabled() ||
                      Severity: Minor
                      Found in Model/Catalog/Layer/ItemCollectionProvider.php - About 55 mins 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 getSwatchMap has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function getSwatchMap(): array
                          {
                              if ($this->swatchMap !== null) {
                                  return $this->swatchMap;
                              }
                      Severity: Minor
                      Found in Model/Swatches/SwatchAttributeResolver.php - About 55 mins 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function execute(Observer $observer)
                          {
                              if (!$this->config->isSearchEnabled()) {
                                  return;
                              }
                      Severity: Minor
                      Found in Model/Observer/CatalogSearchRedirect.php - About 55 mins 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 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              UrlStrategyFactory $urlStrategyFactory,
                              UrlInterface $url,
                              CategoryRepository $categoryRepository,
                              StoreManagerInterface $storeManager,
                              Helper $exportHelper,
                      Severity: Major
                      Found in Model/Client/Type/SuggestionType/SuggestionTypeFacet.php - About 50 mins to fix

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

                                Config $config,
                                Registry $registry,
                                Context $context,
                                TemplateFinder $templateFinder,
                                Session $checkoutSession,
                        Severity: Major
                        Found in Block/Cart/Crosssell/Plugin.php - About 50 mins to fix

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

                                  UrlModel $url,
                                  StrategyHelper $strategyHelper,
                                  CookieManagerInterface $cookieManager,
                                  TweakwiseConfig $config,
                                  Url $layerUrl,
                          Severity: Major
                          Found in Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php - About 50 mins to fix

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

                                    Template\Context $context,
                                    Config $config,
                                    NavigationConfig $navigationConfig,
                                    FilterHelper $filterHelper,
                                    Json $jsonSerializer,
                            Severity: Major
                            Found in Block/LayeredNavigation/RenderLayered/DefaultRenderer.php - About 50 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language