diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 75bd759f7..06f055d36 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -61,11 +61,13 @@ jobs:
- name: 'Prettier code formatting verification'
run: npm run prettier:verify
- # TODO setup apex-scanner and PMD rules - https://github.com/forcedotcom/sfdx-scanner
- # - name: Install & run SFDX Scanner
- # run: |
- # sfdx plugins:install @salesforce/sfdx-scanner
- # sfdx scanner:run --pmdconfig config/pmd-ruleset.xml --target . --engine pmd --severity-threshold 3
+ - name: Install Salesforce CLI
+ run: npm install sfdx-cli --global
+
+ - name: Install & run SFDX Scanner
+ run: |
+ sfdx plugins:install @salesforce/sfdx-scanner
+ sfdx scanner:run --pmdconfig config/pmd-ruleset.xml --target . --engine pmd --severity-threshold 3
lwc-tests:
name: 'LWC Tests'
diff --git a/config/pmd-ruleset.xml b/config/pmd-ruleset.xml
new file mode 100644
index 000000000..05b5fbd0d
--- /dev/null
+++ b/config/pmd-ruleset.xml
@@ -0,0 +1,45 @@
+
+
+
+ Nebula Logger custom PMD ruleset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extra-tests/classes/ExampleInboundEmailHandler.cls b/extra-tests/classes/ExampleInboundEmailHandler.cls
index 5de406112..d22af4758 100644
--- a/extra-tests/classes/ExampleInboundEmailHandler.cls
+++ b/extra-tests/classes/ExampleInboundEmailHandler.cls
@@ -11,9 +11,9 @@ global with sharing class ExampleInboundEmailHandler implements Messaging.Inboun
Logger.error(logEntryMessage, apexException);
} finally {
result.success = true;
- System.debug('Logger buffer size before save: ' + Logger.getBufferSize());
+ System.debug(LoggingLevel.DEBUG, 'Logger buffer size before save: ' + Logger.getBufferSize());
Logger.saveLog();
- System.debug('Logger buffer size after save: ' + Logger.getBufferSize());
+ System.debug(LoggingLevel.DEBUG, 'Logger buffer size after save: ' + Logger.getBufferSize());
}
return result;
diff --git a/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls b/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls
index 77170acd5..a7c549bfe 100644
--- a/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls
+++ b/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls
@@ -18,7 +18,6 @@ private class Logger_Tests_InboundEmailHandler {
Messaging.InboundEmail email = new Messaging.InboundEmail();
email.plainTextBody = 'Example email content';
email.fromAddress = 'test@test.com';
- String contactEmail = 'someone@salesforce.com';
email.subject = 'My example email';
// Create an instance of the example handler class
diff --git a/nebula-logger-plugins/Slack/classes/SlackLoggerPlugin.cls b/nebula-logger-plugins/Slack/classes/SlackLoggerPlugin.cls
index 9d5855d20..acdd07de2 100644
--- a/nebula-logger-plugins/Slack/classes/SlackLoggerPlugin.cls
+++ b/nebula-logger-plugins/Slack/classes/SlackLoggerPlugin.cls
@@ -13,6 +13,8 @@ public without sharing class SlackLoggerPlugin extends LoggerSObjectHandlerPlugi
@TestVisible
private static LoggingLevel notificationLoggingLevel;
+ private List logs;
+
static {
endpoint = LoggerParameter.Plugin.getString('SlackEndpoint');
@@ -20,8 +22,6 @@ public without sharing class SlackLoggerPlugin extends LoggerSObjectHandlerPlugi
notificationLoggingLevel = Logger.getLoggingLevel(notificationLoggingLevelName);
}
- private List logs;
-
// Constructors
public SlackLoggerPlugin() {
}
@@ -78,8 +78,8 @@ public without sharing class SlackLoggerPlugin extends LoggerSObjectHandlerPlugi
request.setBody(notificationJson);
HttpResponse response = new Http().send(request);
- System.debug('response.getStatusCode()==' + response.getStatusCode());
- System.debug('response.getStatus()==' + response.getStatus());
+ System.debug(notificationLoggingLevel, 'response.getStatusCode()==' + response.getStatusCode());
+ System.debug(notificationLoggingLevel, 'response.getStatus()==' + response.getStatus());
log.SlackNotificationDate__c = System.now();
sentLogs.add(log);
@@ -163,7 +163,7 @@ public without sharing class SlackLoggerPlugin extends LoggerSObjectHandlerPlugi
}
private HttpRequest createSlackHttpRequest() {
- System.debug('endpoint==' + endpoint);
+ System.debug(notificationLoggingLevel, 'endpoint==' + endpoint);
HttpRequest request = new HttpRequest();
request.setEndpoint(endpoint);
diff --git a/nebula-logger-recipes/main/default/classes/ExampleInboundEmailHandler.cls b/nebula-logger-recipes/main/default/classes/ExampleInboundEmailHandler.cls
index 5de406112..d22af4758 100644
--- a/nebula-logger-recipes/main/default/classes/ExampleInboundEmailHandler.cls
+++ b/nebula-logger-recipes/main/default/classes/ExampleInboundEmailHandler.cls
@@ -11,9 +11,9 @@ global with sharing class ExampleInboundEmailHandler implements Messaging.Inboun
Logger.error(logEntryMessage, apexException);
} finally {
result.success = true;
- System.debug('Logger buffer size before save: ' + Logger.getBufferSize());
+ System.debug(LoggingLevel.DEBUG, 'Logger buffer size before save: ' + Logger.getBufferSize());
Logger.saveLog();
- System.debug('Logger buffer size after save: ' + Logger.getBufferSize());
+ System.debug(LoggingLevel.DEBUG, 'Logger buffer size after save: ' + Logger.getBufferSize());
}
return result;
diff --git a/nebula-logger-recipes/tests/Logger_Tests_InboundEmailHandler.cls b/nebula-logger-recipes/tests/Logger_Tests_InboundEmailHandler.cls
index 77170acd5..a7c549bfe 100644
--- a/nebula-logger-recipes/tests/Logger_Tests_InboundEmailHandler.cls
+++ b/nebula-logger-recipes/tests/Logger_Tests_InboundEmailHandler.cls
@@ -18,7 +18,6 @@ private class Logger_Tests_InboundEmailHandler {
Messaging.InboundEmail email = new Messaging.InboundEmail();
email.plainTextBody = 'Example email content';
email.fromAddress = 'test@test.com';
- String contactEmail = 'someone@salesforce.com';
email.subject = 'My example email';
// Create an instance of the example handler class
diff --git a/nebula-logger/main/log-management/classes/LogEntryEventHandler.cls b/nebula-logger/main/log-management/classes/LogEntryEventHandler.cls
index d7231a90c..0c90e2cb9 100644
--- a/nebula-logger/main/log-management/classes/LogEntryEventHandler.cls
+++ b/nebula-logger/main/log-management/classes/LogEntryEventHandler.cls
@@ -7,6 +7,7 @@
* @group Log Management
* @description Processes `LogEntryEvent__e` platform events and normalizes the data into `Log__c` and `LogEntry__c` records
*/
+@SuppressWarnings('PMD.ApexCRUDViolation')
public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
private static final Map TRANSACTION_ID_TO_LOG = new Map();
@TestVisible
@@ -276,6 +277,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
insert new List(tagAssignments);
}
+ @SuppressWarnings('PMD.ApexSOQLInjection')
private Map getTagNameToId(Schema.SObjectType tagSObjectType) {
Map tagNameToId = new Map();
@@ -396,7 +398,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
@future(callout=true)
private static void setStatusApiDetails() {
- System.debug('Running setStatusApiDetails()');
+ System.debug(LoggingLevel.DEBUG, 'Running setStatusApiDetails()');
Organization organization = [SELECT InstanceName FROM Organization];
String statusApiEndpoint = 'https://api.status.salesforce.com/v1/instances/' + organization.InstanceName + '/status';
@@ -419,7 +421,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
}
StatusApiResponse statusApiResponse = (StatusApiResponse) JSON.deserialize(response.getBody(), StatusApiResponse.class);
- System.debug('statusApiResponse==' + statusApiResponse);
+ System.debug(LoggingLevel.DEBUG, 'statusApiResponse==' + statusApiResponse);
List logsToUpdate = new List();
for (Log__c log : [
@@ -434,7 +436,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
logsToUpdate.add(log);
}
- System.debug('logsToUpdate==' + logsToUpdate);
+ System.debug(LoggingLevel.DEBUG, 'logsToUpdate==' + logsToUpdate);
update logsToUpdate;
}
diff --git a/nebula-logger/main/log-management/classes/LogEntryHandler.cls b/nebula-logger/main/log-management/classes/LogEntryHandler.cls
index 9c6a215b6..f002936c8 100644
--- a/nebula-logger/main/log-management/classes/LogEntryHandler.cls
+++ b/nebula-logger/main/log-management/classes/LogEntryHandler.cls
@@ -205,6 +205,7 @@ public without sharing class LogEntryHandler extends LoggerSObjectHandler {
}
}
+ @SuppressWarnings('PMD.OperationWithLimitsInLoop')
private void setRecordNames() {
// Assumption - only valid record IDs will be populated in LogEntry__c.RecordId__c
// If that changes, then extra checks may be needed before casting to Id, using getSObjectType(), etc.
diff --git a/nebula-logger/main/log-management/classes/LogHandler.cls b/nebula-logger/main/log-management/classes/LogHandler.cls
index 6c7a43733..fdb23343b 100644
--- a/nebula-logger/main/log-management/classes/LogHandler.cls
+++ b/nebula-logger/main/log-management/classes/LogHandler.cls
@@ -11,6 +11,11 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
@TestVisible
private static Map logStatusByName = loadActiveLogStatuses();
+ @TestVisible
+ private List logs;
+ @TestVisible
+ private Map oldLogsById;
+
private static Map loadActiveLogStatuses() {
Map logStatusByName = new Map();
for (LogStatus__mdt logStatus : LogStatus__mdt.getAll().values()) {
@@ -22,12 +27,6 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
return logStatusByName;
}
- @TestVisible
- private List logs;
-
- @TestVisible
- private Map oldLogsById;
-
/**
* @description Returns SObject Type that the handler is responsible for processing
* @return The instance of `SObjectType`
@@ -133,16 +132,16 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
// 1. Assume that that there will always be 3+ picklist values for the Priority__c field (out of the box, the values are: High, Medium, Low)
// 2. Assume that not everyone will want those exact values, so dynamiclly get picklist entries (e.g., some orgs may instead use Critical, High, Medium, Low)
// 3. Assume that the picklist entries are sorted in order of priority (not alphabetically, etc.)
- final String FIRST_PRIORITY = picklistEntries.get(0).getValue();
- final String SECOND_PRIORITY = picklistEntries.get(1).getValue();
+ final String firstPriority = picklistEntries.get(0).getValue();
+ final String secondPriority = picklistEntries.get(1).getValue();
for (Log__c log : this.logs) {
Log__c oldLog = this.oldLogsById.get(log.Id);
if (log.TotalERRORLogEntries__c != oldLog.TotalERRORLogEntries__c && log.TotalERRORLogEntries__c > 0) {
- log.Priority__c = FIRST_PRIORITY;
+ log.Priority__c = firstPriority;
} else if (log.TotalWARNLogEntries__c != oldLog.TotalWARNLogEntries__c && log.TotalWARNLogEntries__c > 0) {
- log.Priority__c = SECOND_PRIORITY;
+ log.Priority__c = secondPriority;
}
}
}
diff --git a/nebula-logger/main/log-management/classes/LogMassDeleteExtension.cls b/nebula-logger/main/log-management/classes/LogMassDeleteExtension.cls
index 2c7a350f3..8ab0c3d3e 100644
--- a/nebula-logger/main/log-management/classes/LogMassDeleteExtension.cls
+++ b/nebula-logger/main/log-management/classes/LogMassDeleteExtension.cls
@@ -28,6 +28,7 @@ public with sharing class LogMassDeleteExtension {
* @description Filters the list of selected `Log__c` records to only include records that the current user can delete (based on object-level access)
* @return The matching `Log__c` records that the current user has access to delete
*/
+ @SuppressWarnings('PMD.ApexCRUDViolation')
public List getDeletableLogs() {
// The UserRecordAccess object is weird - RecordId is not an actual ID field, so you can't filter using `List` or `List`, you have to use strings
// So, here's some code that would be unnecessary if RecordId were a polymorphic ID field instead
diff --git a/nebula-logger/main/log-management/classes/LoggerSObjectHandler.cls b/nebula-logger/main/log-management/classes/LoggerSObjectHandler.cls
index 8097fb493..e252cdcc6 100644
--- a/nebula-logger/main/log-management/classes/LoggerSObjectHandler.cls
+++ b/nebula-logger/main/log-management/classes/LoggerSObjectHandler.cls
@@ -7,10 +7,25 @@
* @group Log Management
* @description Abstract class used by trigger handlers for shared logic
*/
-public abstract class LoggerSObjectHandler {
+@SuppressWarnings('PMD.ApexCRUDViolation')
+public without sharing abstract class LoggerSObjectHandler {
private static Map configurationBySObjectType;
private static Map> pluginsBySObjectType;
+ @TestVisible
+ private TriggerOperation triggerOperationType;
+ @TestVisible
+ private List triggerNew;
+ @TestVisible
+ private Map triggerNewMap;
+ @TestVisible
+ private List triggerOld;
+ @TestVisible
+ private Map triggerOldMap;
+
+ private LoggerSObjectHandler__mdt handlerConfiguration;
+ private List plugins;
+
static {
// When using CMDT's getAll(), it does not return relationship fields for EntityDefinition fields or child CMDT objects...
// ... so instead query the LoggerSObjectHandler__mdt CMDT object
@@ -65,20 +80,6 @@ public abstract class LoggerSObjectHandler {
pluginsBySObjectType.put(sobjectType, plugins);
}
- @TestVisible
- private TriggerOperation triggerOperationType;
- @TestVisible
- private List triggerNew;
- @TestVisible
- private Map triggerNewMap;
- @TestVisible
- private List triggerOld;
- @TestVisible
- private Map triggerOldMap;
-
- private LoggerSObjectHandler__mdt handlerConfiguration;
- private List plugins;
-
public LoggerSObjectHandler() {
this.setConfigurations();
diff --git a/nebula-logger/main/log-management/classes/RelatedLogEntriesController.cls b/nebula-logger/main/log-management/classes/RelatedLogEntriesController.cls
index f2dfbcdca..04942d620 100644
--- a/nebula-logger/main/log-management/classes/RelatedLogEntriesController.cls
+++ b/nebula-logger/main/log-management/classes/RelatedLogEntriesController.cls
@@ -24,6 +24,7 @@ public with sharing class RelatedLogEntriesController {
* @param search An optional search term to filter by
* @return The instance of LogEntryQueryResult, containing matching records and metadata
*/
+ @SuppressWarnings('PMD.ApexCRUDViolation')
@AuraEnabled(cacheable=true)
public static LogEntryQueryResult getQueryResult(
Id recordId,
@@ -84,7 +85,7 @@ public with sharing class RelatedLogEntriesController {
};
String logEntryQuery = 'SELECT {0} FROM {1} WHERE {2} = :recordId ORDER BY {3} LIMIT {4}';
logEntryQuery = String.format(logEntryQuery, queryTextReplacements);
- System.debug('logEntryQuery==' + logEntryQuery);
+ System.debug(LoggingLevel.DEBUG, 'logEntryQuery==' + logEntryQuery);
return (List) Database.query(logEntryQuery);
}
diff --git a/nebula-logger/main/logger-engine/classes/ComponentLogger.cls b/nebula-logger/main/logger-engine/classes/ComponentLogger.cls
index 11db9c8d7..4eb2b8d88 100644
--- a/nebula-logger/main/logger-engine/classes/ComponentLogger.cls
+++ b/nebula-logger/main/logger-engine/classes/ComponentLogger.cls
@@ -60,7 +60,6 @@ public inherited sharing class ComponentLogger {
private static void setStackTraceDetails(LogEntryEventBuilder logEntryEventBuilder, String stackTraceString) {
String originLocation;
- String originType;
Boolean isAuraComponent = false;
if (String.isNotBlank(stackTraceString) == true) {
diff --git a/nebula-logger/main/logger-engine/classes/LogEntryEventBuilder.cls b/nebula-logger/main/logger-engine/classes/LogEntryEventBuilder.cls
index 3e8e9f5a3..70fd1b972 100644
--- a/nebula-logger/main/logger-engine/classes/LogEntryEventBuilder.cls
+++ b/nebula-logger/main/logger-engine/classes/LogEntryEventBuilder.cls
@@ -8,7 +8,19 @@
* @description Builder class that generates each `LogEntryEvent__e` record
* @see Logger
*/
+@SuppressWarnings('PMD.NcssTypeCount, PMD.ApexCRUDViolation')
global with sharing class LogEntryEventBuilder {
+ private final LogEntryEvent__e logEntryEvent;
+ private final LoggingLevel entryLoggingLevel;
+
+ @TestVisible
+ private String debugMessage = '';
+
+ private Boolean detailsAreSet = false;
+ private Boolean shouldSave;
+ private Set tags = new Set();
+ private Boolean tagDetailsAreSet = true;
+
private static final String API_VERSION = getApiVersion();
private static final List IGNORED_CLASSES = getIgnoredClasses();
private static final String NAMESPACE_PREFIX = getNamespacePrefix();
@@ -77,17 +89,6 @@ global with sharing class LogEntryEventBuilder {
set;
}
- private final LogEntryEvent__e logEntryEvent;
- private final LoggingLevel entryLoggingLevel;
-
- @TestVisible
- private String debugMessage = '';
-
- private Boolean detailsAreSet = false;
- private Boolean shouldSave;
- private Set tags = new Set();
- private Boolean tagDetailsAreSet = true;
-
/**
* @description Used by `Logger` to instantiate a new instance of `LogEntryEventBuilder`
* @param entryLoggingLevel The `LoggingLevel` enum to use for the builder's instance of `LogEntryEvent__e`
diff --git a/nebula-logger/main/logger-engine/classes/Logger.cls b/nebula-logger/main/logger-engine/classes/Logger.cls
index 4a6c264c0..73fdeb856 100644
--- a/nebula-logger/main/logger-engine/classes/Logger.cls
+++ b/nebula-logger/main/logger-engine/classes/Logger.cls
@@ -44,11 +44,7 @@ global with sharing class Logger {
static {
System.debug(LoggingLevel.INFO, 'Logger.getTransactionId() == ' + getTransactionId());
- // If settings have not been configured, then insert the org defaults
- LoggerSettings__c orgDefaults = LoggerSettings__c.getOrgDefaults();
- if (orgDefaults.Id == null) {
- insert orgDefaults;
- }
+ setupOrgDefaults();
}
/**
@@ -2510,7 +2506,7 @@ global with sharing class Logger {
when EVENT_BUS {
// TODO add error handling for when event bus fails to publish
List results = EventBus.publish(logEntryEvents);
- System.debug('saveResults =' + results);
+ System.debug(DEFAULT_LOGGING_LEVEL, 'saveResults =' + results);
}
when QUEUEABLE {
System.enqueueJob(new QueueableSaver(logEntryEvents));
@@ -2641,6 +2637,15 @@ global with sharing class Logger {
return newEntry(loggingLevel, isEnabled(loggingLevel));
}
+ @SuppressWarnings('PMD.ApexCRUDViolation')
+ private static void setupOrgDefaults() {
+ // If settings have not been configured, then insert the org defaults
+ LoggerSettings__c orgDefaults = LoggerSettings__c.getOrgDefaults();
+ if (orgDefaults.Id == null) {
+ insert orgDefaults;
+ }
+ }
+
private static LogEntryEventBuilder newEntry(LoggingLevel loggingLevel, Boolean shouldSave) {
LogEntryEventBuilder logEntryEventBuilder = new LogEntryEventBuilder(LoggingLevel, shouldSave);
if (logEntryEventBuilder.shouldSave() == true) {
@@ -2720,8 +2725,6 @@ global with sharing class Logger {
// Inner class for saving log entries via a queuable job
global class QueueableSaver implements Queueable {
- private Id jobId;
-
private List logEntryEvents = new List();
private QueueableSaver(List logEntryEvents) {
@@ -2738,6 +2741,7 @@ global with sharing class Logger {
private final String BASE_URL = System.Url.getSalesforceBaseUrl().toExternalForm() + '/services/data/v52.0';
private final String COMPOSITE_ENDPOINT = '/composite/sobjects';
+ @SuppressWarnings('PMD.ApexSuggestUsingNamedCred')
public void insertRecords(List records) {
HttpRequest request = new HttpRequest();
request.setEndpoint(BASE_URL + COMPOSITE_ENDPOINT);
@@ -2827,8 +2831,6 @@ global with sharing class Logger {
}
private String formatValue(String unformattedValue) {
- final String invalidValueError = unformattedValue + ' is not a valid UUID value';
-
// Remove any non-alphanumeric characters
unformattedValue = unformattedValue.replaceAll('[^a-zA-Z0-9]', '');
@@ -2855,8 +2857,9 @@ global with sharing class Logger {
private Integer convertHexToInteger(String hexValue) {
hexValue = hexValue.toLowerCase();
- if (hexValue.startsWith(HEX_PREFIX))
+ if (hexValue.startsWith(HEX_PREFIX)) {
hexValue = hexValue.substringAfter(HEX_PREFIX);
+ }
Integer integerValue = 0;
for (String hexCharacter : hexValue.split('')) {
diff --git a/nebula-logger/main/plugin-framework/classes/LoggerParameter.cls b/nebula-logger/main/plugin-framework/classes/LoggerParameter.cls
index 1f44eeb33..c2274b54d 100644
--- a/nebula-logger/main/plugin-framework/classes/LoggerParameter.cls
+++ b/nebula-logger/main/plugin-framework/classes/LoggerParameter.cls
@@ -9,6 +9,9 @@
* and casts the parameters to common data types
*/
public class LoggerParameter {
+ private SObjectType configurationSObjectType;
+ private Map mockParameterByDeveloperName = new Map();
+
/**
* @description An instance of `LoggerParameter` that loads SObject Handler parameters from the object `LoggerSObjectHandlerParameter__mdt`
*/
@@ -35,9 +38,6 @@ public class LoggerParameter {
set;
}
- private SObjectType configurationSObjectType;
- private Map mockParameterByDeveloperName = new Map();
-
private LoggerParameter(Schema.SObjectType configurationSObjectType) {
this.configurationSObjectType = configurationSObjectType;
}
diff --git a/nebula-logger/tests/log-management/classes/LogEntryEventHandler_Tests.cls b/nebula-logger/tests/log-management/classes/LogEntryEventHandler_Tests.cls
index 4ea0d48c9..a53a46d30 100644
--- a/nebula-logger/tests/log-management/classes/LogEntryEventHandler_Tests.cls
+++ b/nebula-logger/tests/log-management/classes/LogEntryEventHandler_Tests.cls
@@ -832,7 +832,6 @@ private class LogEntryEventHandler_Tests {
private static void validateLogFields(LogEntryEvent__e logEntryEvent, Log__c log) {
Organization org = [SELECT Id, Name, InstanceName, IsSandbox, NamespacePrefix, OrganizationType, TrialExpirationDate FROM Organization];
- User currentUser = getCurrentUser();
String orgEnvironmentType;
if (org.IsSandbox == true && org.TrialExpirationDate != null) {
orgEnvironmentType = 'Scratch Org';
diff --git a/nebula-logger/tests/log-management/classes/LogMassDeleteExtension_Tests.cls b/nebula-logger/tests/log-management/classes/LogMassDeleteExtension_Tests.cls
index aacc19d2f..43b2b4048 100644
--- a/nebula-logger/tests/log-management/classes/LogMassDeleteExtension_Tests.cls
+++ b/nebula-logger/tests/log-management/classes/LogMassDeleteExtension_Tests.cls
@@ -113,7 +113,7 @@ private class LogMassDeleteExtension_Tests {
String deleteAccessError = 'You do not have access to delete logs records';
- LogMassDeleteExtension extension = new LogMassDeleteExtension(controller);
+ new LogMassDeleteExtension(controller);
System.assertEquals(true, ApexPages.hasMessages(ApexPages.SEVERITY.ERROR));
System.assertEquals(deleteAccessError, ApexPages.getMessages().get(0).getSummary());
diff --git a/nebula-logger/tests/log-management/classes/RelatedLogEntriesController_Tests.cls b/nebula-logger/tests/log-management/classes/RelatedLogEntriesController_Tests.cls
index 4380e39ef..cf25bfb43 100644
--- a/nebula-logger/tests/log-management/classes/RelatedLogEntriesController_Tests.cls
+++ b/nebula-logger/tests/log-management/classes/RelatedLogEntriesController_Tests.cls
@@ -86,7 +86,6 @@ private class RelatedLogEntriesController_Tests {
System.assertEquals(TOTAL_LOG_ENTRIES + 1, logEntries.size());
Integer countOfMatches = 0;
for (LogEntry__c logEntry : logEntries) {
- System.debug('checking logEntry: ' + logEntry);
if (logEntry.Message__c.contains(search)) {
countOfMatches = countOfMatches + 1;
}
diff --git a/nebula-logger/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls b/nebula-logger/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls
index d4ef2069d..b2ef4b6a9 100644
--- a/nebula-logger/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls
+++ b/nebula-logger/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls
@@ -159,7 +159,6 @@ private class LogEntryEventBuilder_Tests {
LogEntryEventBuilder.addMockDataMaskRule(rule);
String message = 'Something, something, and my social is 400 11 9999 in case you want to steal my identity';
- String expectedSanitizedMessage = 'Something, something, and my social is XXX-XX-9999 in case you want to steal my identity';
Account account = new Account(Name = message);
String accountJson = JSON.serializePretty(account);
LogEntryEventBuilder builder = new LogEntryEventBuilder(LoggingLevel.INFO, true);
@@ -180,7 +179,6 @@ private class LogEntryEventBuilder_Tests {
LogEntryEventBuilder.addMockDataMaskRule(rule);
String message = 'Something, something, and my social is 400 11 9999 in case you want to steal my identity';
- String expectedSanitizedMessage = 'Something, something, and my social is XXX-XX-9999 in case you want to steal my identity';
Account account = new Account(Name = message);
String accountJson = JSON.serializePretty(account);
LogEntryEventBuilder builder = new LogEntryEventBuilder(LoggingLevel.INFO, true);
@@ -887,7 +885,6 @@ private class LogEntryEventBuilder_Tests {
// Get expected data
Organization organization = LoggerTestUtils.getOrganization();
String organizationEnvironmentType = LoggerTestUtils.getOrganizationEnvironmentType();
- SObject networkSite = LoggerTestUtils.getNetwork();
User user = LoggerTestUtils.getUser();
LogEntryEventBuilder builder = new LogEntryEventBuilder(LoggingLevel.INFO, true);
diff --git a/nebula-logger/tests/logger-engine/classes/Logger_Tests.cls b/nebula-logger/tests/logger-engine/classes/Logger_Tests.cls
index 7f3dc1d98..2dd557ecc 100644
--- a/nebula-logger/tests/logger-engine/classes/Logger_Tests.cls
+++ b/nebula-logger/tests/logger-engine/classes/Logger_Tests.cls
@@ -69,6 +69,7 @@ private class Logger_Tests {
List logs = new List();
for (Integer i = 0; i < 3; i++) {
Log__c log = new Log__c(TransactionId__c = '1234' + i);
+ logs.add(log);
}
insert logs;
@@ -94,6 +95,7 @@ private class Logger_Tests {
List logs = new List();
for (Integer i = 0; i < 3; i++) {
Log__c log = new Log__c(TransactionId__c = '1234' + i);
+ logs.add(log);
}
return Database.insert(logs, false);
@@ -135,6 +137,7 @@ private class Logger_Tests {
List logs = new List();
for (Integer i = 0; i < 3; i++) {
Log__c log = new Log__c(TransactionId__c = '1234' + i);
+ logs.add(log);
}
return Database.upsert(logs, false);
@@ -163,6 +166,7 @@ private class Logger_Tests {
List logs = new List();
for (Integer i = 0; i < 3; i++) {
Log__c log = new Log__c(TransactionId__c = '1234' + i);
+ logs.add(log);
}
insert logs;
delete logs;
diff --git a/package.json b/package.json
index 0b6251364..719bd8525 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
"permset:assign:admin": "sfdx force:user:permset:assign --permsetname LoggerAdmin",
"prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
"prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
+ "scan": "sfdx scanner:run --pmdconfig config/pmd-ruleset.xml --target . --engine pmd --severity-threshold 3",
"test": "npm run test:lwc && npm run test:apex",
"test:apex": "sfdx force:apex:test:run --verbose --testlevel RunLocalTests --wait 30 --resultformat human --codecoverage --detailedcoverage --outputdir ./tests/apex",
"test:lwc": "sfdx-lwc-jest --coverage"