Aerendir/aws-ses-monitor-bundle

View on GitHub

Showing 30 of 30 total issues

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

    public function processIdentitiesNotificationAttributes(Result $result): void
    {
        foreach ($result->get('NotificationAttributes') as $identity => $attribute) {
            $this->data[self::IDENTITIES][$identity][self::NOTIFICATIONS] = [
                'forwarding_enabled' => $attribute['ForwardingEnabled'],
Severity: Minor
Found in src/Processor/AwsDataProcessor.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

Avoid too many return statements within this method.
Open

                return new Response('Notification type not understood', 403);
Severity: Major
Found in src/Processor/NotificationProcessor.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return $this->deliveryNotificationHandler->processNotification($notificationData, $mailMessage);
    Severity: Major
    Found in src/Processor/NotificationProcessor.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return true;
      Severity: Major
      Found in src/Util/EmailStatusAnalyzer.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $this->complaintNotificationHandler->processNotification($notificationData, $mailMessage);
        Severity: Major
        Found in src/Processor/NotificationProcessor.php - About 30 mins to fix

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

              private function fetchSubscriptionsData(): void
              {
                  // Returns a list of the requester's subscriptions. Each call returns a limited list of subscriptions, up to 100.
                  // If there are more subscriptions, a NextToken is also returned. Use the NextToken parameter in a new
                  // ListSubscriptions call to get further results.
          Severity: Minor
          Found in src/Service/Monitor.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 logActionsToTake has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function logActionsToTake(): void
              {
                  if (false === empty($this->actionsToTakeNow)) {
                      $this->ioWriter->warning('There are pending actions.');
                      $this->ioWriter->writeln('You have to take the actions listed below, then run again the command <comment>bin/console aws:ses:configure</comment> to complete the configuration.');
          Severity: Minor
          Found in src/Command/ConfigureCommand.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 getConfiguredIdentitiesList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getConfiguredIdentitiesList(bool $ignoreEnv = false): array
              {
                  if ($ignoreEnv) {
                      return [
                          'allowed' => $this->configuredIdentities->getIdentitiesList(),
          Severity: Minor
          Found in src/Service/Monitor.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 canReceiveMessages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function canReceiveMessages(EmailStatus $emailStatus, string $identity): bool
              {
                  $filter     = $this->monitor->findConfiguredIdentity($identity, 'bounces')['filter'];
                  $maxBounces = $filter['max_bounces'];
                  $softAsHard = $filter['soft_as_hard'];
          Severity: Minor
          Found in src/Util/EmailStatusAnalyzer.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 identityRequiresTopicSubscription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function identityRequiresTopicSubscription(string $identity, string $notificationType): bool
              {
                  $identityNotifications = $this->getLiveIdentity($identity, 'notifications');
          
                  // If the notification SNS topic is not configured
          Severity: Minor
          Found in src/Service/Monitor.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