EmicoEcommerce/Magento2Tweakwise

View on GitHub

Showing 121 of 156 total issues

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

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

              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

        Function buildFilterSlugPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function buildFilterSlugPath(array $filters): string
            {
                if (empty($filters)) {
                    return '';
                }
        Severity: Minor
        Found in Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php - About 45 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 getActiveItems has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getActiveItems()
            {
                $result = [];
                foreach ($this->getItems() as $item) {
                    if (!$item->isActive()) {
        Severity: Minor
        Found in Model/Catalog/Layer/Filter.php - About 45 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 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

          Function aroundGetAvailableOrders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function aroundGetAvailableOrders(Toolbar $subject, Closure $proceed)
              {
                  if (!$this->config->isLayeredEnabled()) {
                      if (!$this->config->isSearchEnabled() || !($this->context->getRequest() instanceof ProductSearchRequest)) {
                          return $proceed();
          Severity: Minor
          Found in Block/Catalog/Product/ProductList/Toolbar/Plugin.php - About 45 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 getSwatchData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getSwatchData(Filter $filter): array
              {
                  // Get a map of filter item labels keyed by label
                  $labels = array_flip(
                      array_map(
          Severity: Minor
          Found in Model/Swatches/SwatchAttributeResolver.php - About 45 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 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  Context $context,
                  Config $config,
                  AjaxNavigationResult $ajaxNavigationResult,
                  HashInputProvider $hashInputProvider,
                  Timer $timer,
          Severity: Minor
          Found in Controller/Ajax/Navigation.php - About 45 mins to fix

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

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

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

                      Context $context,
                      Resolver $layerResolver,
                      Config $config,
                      Url $url,
                      CurrentContext $currentContext,
              Severity: Minor
              Found in Block/LayeredNavigation/Navigation/State.php - About 45 mins to fix

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

                    public function apply(MagentoHttpRequest $request, ProductNavigationRequest $navigationRequest): FilterApplierInterface
                    {
                        // Order / pagination etc. is still done with query parameters. Also apply this using the queryParameter strategy
                        $this->queryParameterStrategy->apply($request, $navigationRequest);
                        $filterPath = $request->getParam(self::REQUEST_FILTER_PATH);
                Severity: Minor
                Found in Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php - About 45 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 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        Client $client,
                        RequestFactory $requestFactory,
                        CollectionFactory $collectionFactory,
                        CatalogConfig $catalogConfig,
                        Visibility $visibility,
                Severity: Minor
                Found in Model/Catalog/Product/Recommendation/Context.php - About 45 mins to fix

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

                      public function __construct(ScopeConfigInterface $config, Json $jsonSerializer, RequestInterface $request, State $state, WriterInterface $configWriter, TypeListInterface $cacheTypeList)
                  Severity: Minor
                  Found in Model/Config.php - About 45 mins to fix

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

                            CategoryRepository $categoryRepository,
                            StoreManagerInterface $storeManager,
                            UrlInterface $url,
                            Helper $exportHelper,
                            Config $config,
                    Severity: Minor
                    Found in Model/Client/Type/SuggestionType/SuggestionTypeCategory.php - About 45 mins to fix

                      Function aroundGetFilters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function aroundGetFilters(FilterList $subject, Closure $proceed, Layer $layer)
                          {
                              if (!$this->config->isLayeredEnabled()) {
                                  if (!$this->config->isSearchEnabled() || !($layer instanceof Layer\Search)) {
                                      return $proceed($layer);
                      Severity: Minor
                      Found in Model/Catalog/Layer/FilterList/Plugin.php - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getItems()
                          {
                              $query = $this->dataProviderHelper->getQuery();
                              $category = $this->dataProviderHelper->getCategory();
                              $promises = [];
                      Severity: Minor
                      Found in Model/Autocomplete/DataProvider/SuggestionDataProvider.php - About 45 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

                      Consider simplifying this complex logical expression.
                      Open

                      !function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
                      Severity: Major
                      Found in view/frontend/web/js/lib/jquery.ui.touch-punch.min.js - About 40 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language