Smile-SA/magento2-module-custom-entity

View on GitHub

Showing 26 of 26 total issues

Method getDefaultAttributes has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getDefaultAttributes(): array
    {
        return [
            'name' => [
                'type' => 'varchar',
Severity: Minor
Found in Setup/CustomEntitySetup.php - About 1 hr to fix

    Method _prepareForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _prepareForm(): self
        {
            parent::_prepareForm();
    
            $form     = $this->getForm();
    Severity: Minor
    Found in Block/Adminhtml/Attribute/Edit/Tab/Main.php - About 1 hr to fix

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

              Context $context,
              Registry $registry,
              ExtensionAttributesFactory $extensionFactory,
              AttributeValueFactory $customAttributeFactory,
              StoreManagerInterface $storeManager,
      Severity: Major
      Found in Model/CustomEntity.php - About 1 hr to fix

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

                Context $context,
                Registry $registry,
                FormFactory $formFactory,
                Data $eavData,
                YesnoFactory $yesnoFactory,
        Severity: Major
        Found in Block/Adminhtml/Attribute/Edit/Tab/Main.php - About 1 hr to fix

          Method saveWebsiteIds has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function saveWebsiteIds(CustomEntityModel $entity): self
              {
                  if ($this->storeManager->isSingleStoreMode()) {
                      $websiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
                      $entity->setWebsiteIds([$websiteId]);
          Severity: Minor
          Found in Model/ResourceModel/CustomEntity.php - About 1 hr to fix

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

                    CustomEntityFactory $customEntityFactory,
                    CustomEntityResource $customEntityResource,
                    StoreManagerInterface $storeManager,
                    MetadataPool $metadataPool,
                    ExtensibleDataObjectConverter $extensibleDataObjectConverter,
            Severity: Major
            Found in Model/CustomEntityRepository.php - About 1 hr to fix

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

                      Context $context,
                      EncoderInterface $jsonEncoder,
                      TypeFactory $typeFactory,
                      GroupFactory $groupFactory,
                      CollectionFactory $collectionFactory,
              Severity: Major
              Found in Block/Adminhtml/Set/Main.php - About 1 hr to fix

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

                        Context $context,
                        EntityManager $entityManager,
                        TypeFactory $typeFactory,
                        SetFactory $setFactory,
                        DefaultAttributes $defaultAttributes,
                Severity: Major
                Found in Model/ResourceModel/CustomEntity.php - About 1 hr to fix

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

                          $name,
                          $primaryFieldName,
                          $requestFieldName,
                          CollectionFactory $collectionFactory,
                          array $addFieldStrategies = [],
                  Severity: Major
                  Found in Ui/DataProvider/CustomEntity/Listing/CustomEntityDataProvider.php - About 1 hr to fix

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

                        protected function saveWebsiteIds(CustomEntityModel $entity): self
                        {
                            if ($this->storeManager->isSingleStoreMode()) {
                                $websiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
                                $entity->setWebsiteIds([$websiteId]);
                    Severity: Minor
                    Found in Model/ResourceModel/CustomEntity.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(DataObject $object): void
                        {
                            foreach ($this->getMediaAttributes() as $attributeCode) {
                                $mediaFileName = $object->getData($attributeCode);
                    
                    
                    Severity: Minor
                    Found in Model/ResourceModel/CustomEntity/MediaImageDeleteProcessor.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

                            CustomEntityRepositoryInterface $customEntityRepository,
                            Registry $registry,
                            PageFactory $resultPageFactory,
                            ForwardFactory $resultForwardFactory,
                            FilterManager $filterManager,
                    Severity: Major
                    Found in Controller/Entity/View.php - About 50 mins to fix

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

                              $name,
                              $primaryFieldName,
                              $requestFieldName,
                              PoolInterface $pool,
                              CollectionFactory $collectionFactory,
                      Severity: Major
                      Found in Ui/DataProvider/CustomEntity/Form/CustomEntityDataProvider.php - About 50 mins to fix

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

                                AttributeSetRepositoryInterface $attributeSetRepository,
                                Registry $registry,
                                PageFactory $resultPageFactory,
                                ForwardFactory $resultForwardFactory,
                                FilterManager $filterManager,
                        Severity: Minor
                        Found in Controller/Set/View.php - About 45 mins to fix

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

                              protected function modifyMetaConfig(array $metaConfig): array
                              {
                                  if (isset($metaConfig['children'])) {
                                      foreach ($metaConfig['children'] as $attributeCode => $attributeConfig) {
                                          if ($this->startsWith($attributeCode, self::CONTAINER_PREFIX)) {
                          Severity: Minor
                          Found in Ui/DataProvider/CustomEntity/Form/Modifier/CustomEntityAttribute.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,
                                  DataViewModel $dataViewModel,
                                  Builder $attributeBuilder,
                                  ForwardFactory $resultForwardFactory,
                                  JsonFactory $resultJsonFactory,
                          Severity: Minor
                          Found in Controller/Adminhtml/Attribute/Validate.php - About 45 mins to fix

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

                                public function modifyData(array $data): array
                                {
                                    if (!$this->locator->getEntity()->getId()) {
                                        return $data;
                                    }
                            Severity: Minor
                            Found in Ui/DataProvider/CustomEntity/Form/Modifier/CustomEntityAttribute.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 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    Context $context,
                                    Registry $registry,
                                    FormFactory $formFactory,
                                    Yesno $yesNo,
                                    array $data = []
                            Severity: Minor
                            Found in Block/Adminhtml/Attribute/Edit/Tab/Front.php - About 35 mins to fix

                              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

                                        LoggerInterface $logger,
                                        Registry $registry,
                                        Config $eavConfig,
                                        CustomEntityAttributeInterfaceFactory $attributeFactory,
                                        CustomEntityAttributeRepositoryInterface $attributeRepository
                                Severity: Minor
                                Found in Controller/Adminhtml/Attribute/Builder.php - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language