Showing 89 of 122 total issues

Method buildTcaArray has 178 lines of code (exceeds 40 allowed). Consider refactoring.
Open

    protected function buildTcaArray(): array
    {
        return [
            'ctrl' => $this->getCtrl(),

    EntityEmailNotification has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class EntityEmailNotification extends EntityNotification implements
        EmailNotification,
        CustomSettingsNotification,
        Creatable,
        Editable,

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          protected static function fetchSettingsClassName(array $data): array
          {
              $channelClassName = $data['className'] ?? null;
      
              if (class_exists($channelClassName)
      Classes/Core/Definition/Tree/Notification/NotificationDefinition.php on lines 228..250

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 154.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          protected static function fetchSettingsClassName(array $data): array
          {
              $notificationClassName = $data['className'] ?? null;
      
              if (class_exists($notificationClassName)
      Classes/Core/Definition/Tree/Notification/Channel/ChannelDefinition.php on lines 138..160

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 154.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method addDefaultTypo3Columns has 82 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

          private function addDefaultTypo3Columns()
          {
              $defaultColumns = [
                  'sys_language_uid' => [
                      'exclude' => 1,
      Severity: Major
      Found in Classes/Core/Notification/TCA/EntityTcaWriter.php - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        declare(strict_types=1);
        
        /*
         * Copyright (C)
        Classes/Core/Definition/Tree/Notification/Settings/NotificationSettingsResolver.php on lines 1..66

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 135.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        declare(strict_types=1);
        
        /*
         * Copyright (C)
        Classes/Core/Definition/Tree/Notification/Channel/Settings/ChannelSettingsResolver.php on lines 1..66

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 135.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        declare(strict_types=1);
        
        /*
         * Copyright (C)
        Classes/Domain/Notification/Log/Application/EntityLog/Service/EntityLogMessageBuilder.php on lines 1..66

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 125.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        declare(strict_types=1);
        
        /*
         * Copyright (C)
        Classes/Domain/Notification/Slack/Application/EntitySlack/Service/EntitySlackMessageBuilder.php on lines 1..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 125.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method addCommonColumns has 69 lines of code (exceeds 40 allowed). Consider refactoring.
        Open

            private function addCommonColumns()
            {
                $commonColumns = [
                    'title' => [
                        'exclude' => 1,
        Severity: Major
        Found in Classes/Core/Notification/TCA/EntityTcaWriter.php - About 2 hrs to fix

          Method buildTcaArray has 60 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

              protected function buildTcaArray(): array
              {
                  return [
                      'ctrl' => $this->getDefaultCtrl(),
          
          

            Avoid excessively long variable names like $supportedNotificationsWereChecked. Keep variable name length under 30.
            Open

                private static $supportedNotificationsWereChecked = false;

            LongVariable

            Since: 0.2

            Detects when a field, formal or local variable is declared with a long name.

            Example

            class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

            Source https://phpmd.org/rules/naming.html#longvariable

            Avoid excessively long class names like DispatchFormNotificationEventPropertyBuilder. Keep class name length under 40.
            Open

            class DispatchFormNotificationEventPropertyBuilder implements PropertyBuilder, SingletonInterface
            {
                /**
                 * @var TagsPropertyService
                 */

            LongClassName

            Since: 2.9

            Detects when classes or interfaces are declared with excessively long names.

            Example

            class ATooLongClassNameThatHintsAtADesignProblem {
            
            }
            
            interface ATooLongInterfaceNameThatHintsAtADesignProblem {
            
            }

            Source https://phpmd.org/rules/naming.html#longclassname

            Avoid excessively long variable names like $notificationDefinitionIdentifier. Keep variable name length under 30.
            Open

                    $notificationDefinitionIdentifier = $this->getNotificationDefinitionIdentifier();

            LongVariable

            Since: 0.2

            Detects when a field, formal or local variable is declared with a long name.

            Example

            class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

            Source https://phpmd.org/rules/naming.html#longvariable

            Function buildDefinition has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public function buildDefinition(): ConfigurationObjectInstance
                {
                    if (null === $this->definitionObject) {
                        if ($this->cacheService->has(NotizConstants::CACHE_KEY_DEFINITION_OBJECT)) {
                            $this->definitionObject = $this->cacheService->get(NotizConstants::CACHE_KEY_DEFINITION_OBJECT);
            Severity: Minor
            Found in Classes/Core/Definition/Builder/DefinitionBuilder.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 registerBackendModule has 48 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                protected function registerBackendModule()
                {
                    ExtensionUtility::registerModule(
                        'CuyZ.Notiz',
                        'notiz',
            Severity: Minor
            Found in Classes/Service/Extension/TablesConfigurationService.php - About 1 hr to fix

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

                  protected function getDropDownFromDefinition(): string
                  {
                      $view = $this->getFluidTemplateObject('Backend/ToolBar/NotificationToolBarDropDown');
              
                      if (!$this->definitionService->getValidationResult()->hasErrors()) {
              Severity: Minor
              Found in Classes/Backend/ToolBarItems/NotificationsToolbarItem.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 doLocalize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function doLocalize(string $path, array $arguments = []): string
                  {
                      if (false === strpos($path, ':')) {
                          $possiblePaths = $this->getPossiblePaths('locallang', $path);
                      } elseif (strpos($path, 'LLL:') === 0) {
              Severity: Minor
              Found in Classes/Service/LocalizationService.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 channelsSupportNotifications has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function channelsSupportNotifications()
                  {
                      foreach ($this->definition->getNotifications() as $notification) {
                          foreach ($notification->getChannels() as $channelDefinition) {
                              $path = 'notifications.' . $notification->getIdentifier() . '.channels.' . $channelDefinition->getIdentifier();
              Severity: Minor
              Found in Classes/Validation/Validator/DefinitionValidator.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 process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function process(...$arguments)
                  {
                      $notifications = $this->notificationDispatcher->fetchNotifications($this->eventDefinition);
              
                      foreach ($notifications as $notification => $dispatchCallback) {
              Severity: Minor
              Found in Classes/Core/Event/Runner/EventRunner.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

              Severity
              Category
              Status
              Source
              Language