Smile-SA/magento2-module-custom-entity

View on GitHub

Showing 26 of 26 total issues

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

        SitemapItemInterfaceFactory $itemFactory,
        ConfigReader $configReader,
        CustomEntityRepositoryInterface $customEntityRepository,
        SearchCriteriaBuilder $searchCriteriaBuilder,
        UrlInterface $urlBuilder
Severity: Minor
Found in Model/Sitemap/CustomEntityProvider.php - About 35 mins to fix

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

            Template\Context $context,
            Registry $registry,
            ImageFactory $imageFactory,
            ?CustomEntity $customEntity,
            array $data = []
    Severity: Minor
    Found in Block/CustomEntity/View.php - About 35 mins to fix

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

              Context $context,
              Builder $attributeBuilder,
              ForwardFactory $resultForwardFactory,
              DataViewModel $dataViewModel,
              ?FormData $formDataSerializer
      Severity: Minor
      Found in Controller/Adminhtml/Attribute/Save.php - About 35 mins to fix

        Function get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get($entityId, ?int $storeId = null, bool $forceReload = false): ?CustomEntityInterface
            {
                $cacheKey = $storeId ?? 'all';
        
                if (!isset($this->instances[$entityId][$cacheKey]) || $forceReload === true) {
        Severity: Minor
        Found in Model/CustomEntityRepository.php - About 25 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 getStoreIds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getStoreIds(): ?array
            {
                if (!$this->hasStoreIds()) {
                    $storeIds = [];
                    $websiteIds = $this->getWebsiteIds();
        Severity: Minor
        Found in Model/CustomEntity.php - About 25 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 customEntityAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function customEntityAttribute(
                CustomEntityInterface $customEntity,
                string $attributeHtml,
                string $attributeName
            ): ?string {
        Severity: Minor
        Found in ViewModel/Output.php - About 25 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

        Severity
        Category
        Status
        Source
        Language