EmicoEcommerce/Magento2Tweakwise

View on GitHub

Showing 132 of 165 total issues

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

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

    public function createFilterSlugByAttributeOptions(array $options)
    {
        foreach ($options as $option) {
            if (empty($option->getLabel()) || ctype_space((string) $option->getLabel())) {
                continue;
Severity: Minor
Found in Model/Catalog/Layer/Url/Strategy/FilterSlugManager.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 buildFilterUrl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildFilterUrl(MagentoHttpRequest $request, array $filters = []): string
    {
        $currentUrl = $this->getOriginalUrl($request);

        $currentFilterPath = $request->getParam(self::REQUEST_FILTER_PATH);
Severity: Minor
Found in Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.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 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 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 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/Cart/Crosssell/Plugin.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 __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

                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

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

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

                      public function addParameter($parameter, $value, $separator = '|')
                      {
                          if (isset($this->parameters[$parameter])) {
                              if ($value == null) {
                                  unset($this->parameters[$parameter]);
                  Severity: Minor
                  Found in Model/Client/Request.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 getItems has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getItems()
                      {
                          $query = $this->dataProviderHelper->getQuery();
                          if (empty($query)) {
                              return [];
                  Severity: Minor
                  Found in Model/Autocomplete/DataProvider/SuggestionDataProvider.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

                          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

                            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

                              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
                        Severity
                        Category
                        Status
                        Source
                        Language