Aerendir/aws-ses-monitor-bundle

View on GitHub

Showing 30 of 30 total issues

File ConfigureCommand.php has 367 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in src/Command/ConfigureCommand.php - About 4 hrs to fix

    Monitor has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class Monitor
    {
        /** @var string */
        private const TRACK = 'track';
    
    
    Severity: Minor
    Found in src/Service/Monitor.php - About 4 hrs to fix

      File Monitor.php has 329 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      
      /*
      Severity: Minor
      Found in src/Service/Monitor.php - About 3 hrs to fix

        Function validateTopic has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            private function validateTopic(string $identity, string $type, string $topic, array $identities): void
            {
                $currentPath      = sprintf('shq_aws_ses_monitor.identities.%s.%s.topic', $identity, $type);
                $checkCurrentPath = sprintf('Check the configuration at path "%s".', $currentPath);
                $wantsToUseDomain = self::USE_DOMAIN === $topic;
        Severity: Minor
        Found in src/DependencyInjection/Configuration.php - About 3 hrs 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

        Bounce has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Bounce
        {
            /** Hard bounces and subtypes.
             * @var string */
            public const TYPE_PERMANENT = 'Permanent';
        Severity: Minor
        Found in src/Entity/Bounce.php - About 2 hrs to fix

          ConfigureCommand has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          final class ConfigureCommand extends Command
          {
              /** @var string */
              private const FORCE = 'force';
          
          
          Severity: Minor
          Found in src/Command/ConfigureCommand.php - About 2 hrs to fix

            MailMessage has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class MailMessage
            {
                /**
                 * A unique ID that Amazon SES assigned to the message.
                 *
            Severity: Minor
            Found in src/Entity/MailMessage.php - About 2 hrs to fix

              Method subscribeIdentityToTopic has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function subscribeIdentityToTopic(string $identity, string $messageType): void
                  {
                      static $lastCall = 0;
                      switch ($messageType) {
                          case SnsTypes::MESSAGE_TYPE_BOUNCE:
              Severity: Minor
              Found in src/Command/ConfigureCommand.php - About 1 hr to fix

                Method getConfigTreeBuilder has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getConfigTreeBuilder(): TreeBuilder
                    {
                        $this->identityGuesser = new IdentityGuesser();
                
                        $treeBuilder = new TreeBuilder('shq_aws_ses_monitor');
                Severity: Minor
                Found in src/DependencyInjection/Configuration.php - About 1 hr to fix

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

                      private function checkIdentityDkimConfiguration(string $identity): void
                      {
                          // (Requires a verified identity) If the remote configuration is different than the local configuration...
                          $this->console->overwrite('Checking DKIM configuration...', $this->sectionBody);
                          $log = sprintf('Identity <comment>%s</comment> is not still verified: cannot synch dkim enabling', $identity);
                  Severity: Minor
                  Found in src/Command/ConfigureCommand.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 checkIdentityVerificationStatus has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function checkIdentityVerificationStatus(string $identity): void
                      {
                          // If the identity is not still verified (or doesn't exist at all)...
                          $this->console->overwrite('Checking Identity verification status:', $this->sectionBody);
                          $log = sprintf('Identity <comment>%s</comment> is already verified: skipping...', $identity);
                  Severity: Minor
                  Found in src/Command/ConfigureCommand.php - About 1 hr to fix

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

                        private function checkIdentityDkimConfiguration(string $identity): void
                        {
                            // (Requires a verified identity) If the remote configuration is different than the local configuration...
                            $this->console->overwrite('Checking DKIM configuration...', $this->sectionBody);
                            $log = sprintf('Identity <comment>%s</comment> is not still verified: cannot synch dkim enabling', $identity);
                    Severity: Minor
                    Found in src/Command/ConfigureCommand.php - About 1 hr to fix

                      Method validateTopic has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function validateTopic(string $identity, string $type, string $topic, array $identities): void
                          {
                              $currentPath      = sprintf('shq_aws_ses_monitor.identities.%s.%s.topic', $identity, $type);
                              $checkCurrentPath = sprintf('Check the configuration at path "%s".', $currentPath);
                              $wantsToUseDomain = self::USE_DOMAIN === $topic;
                      Severity: Minor
                      Found in src/DependencyInjection/Configuration.php - About 1 hr to fix

                        Method execute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function execute(InputInterface $input, OutputInterface $output)
                            {
                                // Show to developer the selction of identities
                                $selectedIdentities = $this->getHelper('question')->ask($input, $output, $this->createIdentitiesQuestion());
                        
                        
                        Severity: Minor
                        Found in _bak/SnsSetupCommandAbstract.php - About 1 hr to fix

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

                                  string $env,
                                  AwsDataProcessor $awsDataProcessor,
                                  Console $console,
                                  IdentitiesStore $configuredIdentities,
                                  IdentityGuesser $identityGuesser,
                          Severity: Major
                          Found in src/Service/Monitor.php - About 50 mins to fix

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

                                private function subscribeIdentityToTopic(string $identity, string $messageType): void
                                {
                                    static $lastCall = 0;
                                    switch ($messageType) {
                                        case SnsTypes::MESSAGE_TYPE_BOUNCE:
                            Severity: Minor
                            Found in src/Command/ConfigureCommand.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

                                    string $env,
                                    EntityManagerInterface $entityManager,
                                    Monitor $monitor,
                                    SesManager $sesManager,
                                    SnsManager $snsManager,
                            Severity: Minor
                            Found in src/Command/ConfigureCommand.php - About 45 mins to fix

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

                                  public function __construct(array $configuration, string $notificationType, AwsClientFactory $awsClientFactory, EntityManagerInterface $entityManager, RouterInterface $router)
                              Severity: Minor
                              Found in _bak/SnsSetupCommandAbstract.php - About 35 mins to fix

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

                                        BounceNotificationHandler $bounceNotificationHandler,
                                        ComplaintNotificationHandler $complaintNotificationHandler,
                                        DeliveryNotificationHandler $deliveryNotificationHandler,
                                        EntityManagerInterface $entityManager,
                                        MessageHelper $messageHelper
                                Severity: Minor
                                Found in src/Processor/NotificationProcessor.php - About 35 mins to fix

                                  Function filterBlacklisted has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function filterBlacklisted(array $identities, array $recipients): array
                                      {
                                          $emails         = \array_keys($recipients);
                                          $fromIdentities = \array_keys($identities);
                                  
                                  
                                  Severity: Minor
                                  Found in src/Plugin/MonitorFilterPlugin.php - About 35 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