Skip to content

Commit

Permalink
Fixed some PMD scan violations
Browse files Browse the repository at this point in the history
  • Loading branch information
jongpie committed Oct 12, 2023
1 parent cc27bf8 commit 3b61e28
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public without sharing class LoggerEmailSender {
if (LoggerParameter.ENABLE_SYSTEM_MESSAGES == true) {
// One of a few limited places in the codebase (except tests) that should use System.debug()
// The rest of the codebase should use a method in Logger.cls
System.debug(System.LoggingLevel.WARN, 'Nebula Logger - no Apex email recipients configured, skipping sending email');
System.debug(System.LoggingLevel.WARN, 'Nebula Logger - no Apex email recipients configured, skipping sending email'); // NOPMD
}
return;
}
Expand All @@ -101,7 +101,7 @@ public without sharing class LoggerEmailSender {
message.setTargetObjectId(notification.UserId);
message.setSaveAsActivity(false);
} else if (String.isNotBlank(notification.Email) == true) {
message.setToAddresses(notification.Email);
message.setToAddresses(new List<String>{ notification.Email });
}
messages.add(message);
}
Expand Down Expand Up @@ -133,7 +133,7 @@ public without sharing class LoggerEmailSender {
}

private static void sendEmail(List<Messaging.SingleEmailMessage> messages) {
SENT_EMAILS.add(message);
SENT_EMAILS.addAll(messages);
if (IS_EMAIL_DELIVERABILITY_AVAILABLE) {
List<Messaging.SendEmailResult> emailResults = System.Messaging.sendEmail(messages);

Expand All @@ -142,11 +142,11 @@ public without sharing class LoggerEmailSender {
} else if (emailResults.get(0).success == true) {
// One of a few limited places in the codebase (except tests) that should use System.debug()
// The rest of the codebase should use a method in Logger.cls
System.debug(System.LoggingLevel.INFO, 'Nebula Logger - The email was sent successfully');
System.debug(System.LoggingLevel.INFO, 'Nebula Logger - The email was sent successfully'); // NOPMD
} else {
// One of a few limited places in the codebase (except tests) that should use System.debug()
// The rest of the codebase should use a method in Logger.cls
System.debug(System.LoggingLevel.WARN, 'Nebula Logger - The email failed to send: ' + emailResults.get(0).errors.get(0).message);
System.debug(System.LoggingLevel.WARN, 'Nebula Logger - The email failed to send: ' + emailResults.get(0).errors.get(0).message); // NOPMD
}
}
}
Expand Down Expand Up @@ -174,7 +174,6 @@ public without sharing class LoggerEmailSender {
}

private static List<ApexEmailNotification> queryApexErrrorRecipients() {
List<String> apexErrrorRecipients = new List<String>();
List<ApexEmailNotification> notifications = LogManagementDataSelector.getInstance().getCachedApexEmailNotifications();
if (System.Test.isRunningTest()) {
notifications.clear();
Expand Down

0 comments on commit 3b61e28

Please sign in to comment.