Skip to content

Commit

Permalink
Bulk updated the convention used throughout the codebase for checking…
Browse files Browse the repository at this point in the history
… Booleans from 'if(condition == true)' to just 'if(condition)'
  • Loading branch information
jongpie committed Oct 5, 2023
1 parent ef676e4 commit 668f2d1
Show file tree
Hide file tree
Showing 51 changed files with 327 additions and 332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public with sharing class MyProfilePageControllerTest {
// System.Assert.areEqual(currentUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
// System.Assert.isTrue(controller.getIsEdit() == false, 'isEdit should default to false');
controller.edit();
// System.Assert.isTrue(controller.getIsEdit() == true);
// System.Assert.isTrue(controller.getIsEdit());
controller.cancel();
// System.Assert.isTrue(controller.getIsEdit() == false);

Expand All @@ -41,7 +41,7 @@ public with sharing class MyProfilePageControllerTest {
// System.Assert.areEqual(existingPortalUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
// System.Assert.isTrue(controller.getIsEdit() == false, 'isEdit should default to false');
controller.edit();
// System.Assert.isTrue(controller.getIsEdit() == true);
// System.Assert.isTrue(controller.getIsEdit());

controller.cancel();
// System.Assert.isTrue(controller.getIsEdit() == false);
Expand Down
2 changes: 1 addition & 1 deletion docs/apex/Configuration/LoggerPlugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The list of matching `LoggerPlugin_t` records

#### `getPluginConfigurations()``List<LoggerPlugin_t>`

Returns all enabled `LoggerPlugin_t` records, based on `IsEnabled__c == true`
Returns all enabled `LoggerPlugin_t` records (where `IsEnabled__c` is set to `true`)

##### Return

Expand Down
2 changes: 1 addition & 1 deletion docs/apex/Logger-Engine/FlowLogger.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Boolean used to determine if logs are saved to Salesforce

###### `saveMethodName``String`

String name of the instance of Logger.SaveMethod to use when &apos;Save Log&apos; == true
String name of the instance of Logger.SaveMethod to use when &apos;Save Log&apos; is set to `true`

###### `scenario``String`

Expand Down
2 changes: 1 addition & 1 deletion docs/apex/Logger-Engine/Logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -4738,7 +4738,7 @@ Boolean

#### `newEntry(System.LoggingLevel loggingLevel, LogMessage logMessage, Boolean shouldSave)``LogEntryEventBuilder`

Adds a new instance of LogEntryEventBuilder to Logger&apos;s buffer, if shouldSave == true
Adds a new instance of LogEntryEventBuilder to Logger&apos;s buffer, when `shouldSave` is `true`

##### Parameters

Expand Down
88 changes: 44 additions & 44 deletions docs/apex/Test-Utilities/LoggerMockDataCreator.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ Creates a mock instance of `Database.DeleteResult` - a mock is used instead of a

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |

##### Return

Expand All @@ -96,10 +96,10 @@ Creates a mock instance of `Database.DeleteResult` - a mock is used instead of a

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| `recordId` | The record ID to use within the mock result |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |
| `recordId` | The record ID to use within the mock result |

##### Return

Expand All @@ -117,9 +117,9 @@ Creates a mock instance of `Database.LeadConvertResult` - a mock is used instead

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |

##### Return

Expand All @@ -137,10 +137,10 @@ Creates a mock instance of `Database.LeadConvertResult` - a mock is used instead

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| `recordId` | The record ID to use within the mock result |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |
| `recordId` | The record ID to use within the mock result |

##### Return

Expand All @@ -158,9 +158,9 @@ Creates a mock instance of `Database.MergeResult` - a mock is used instead of an

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |

##### Return

Expand All @@ -178,10 +178,10 @@ Creates a mock instance of `Database.MergeResult` - a mock is used instead of an

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| `recordId` | The record ID to use within the mock result |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |
| `recordId` | The record ID to use within the mock result |

##### Return

Expand All @@ -199,9 +199,9 @@ Creates a mock instance of `Database.SaveResult` - a mock is used instead of an

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |

##### Return

Expand All @@ -219,10 +219,10 @@ Creates a mock instance of `Database.SaveResult` - a mock is used instead of an

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| `recordId` | The record ID to use within the mock result |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |
| `recordId` | The record ID to use within the mock result |

##### Return

Expand All @@ -240,9 +240,9 @@ Creates a mock instance of `Database.UndeleteResult` - a mock is used instead of

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |

##### Return

Expand All @@ -260,10 +260,10 @@ Creates a mock instance of `Database.UndeleteResult` - a mock is used instead of

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| `recordId` | The record ID to use within the mock result |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |
| `recordId` | The record ID to use within the mock result |

##### Return

Expand All @@ -281,10 +281,10 @@ Creates a mock instance of `Database.UpsertResult` - a mock is used instead of a

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| `isCreated` | Indicates if the generated mock should have `isCreated` == true |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |
| `isCreated` | Indicates if the generated mock should have `isCreated` |

##### Return

Expand All @@ -302,11 +302,11 @@ Creates a mock instance of `Database.UpsertResult` - a mock is used instead of a

##### Parameters

| Param | Description |
| ----------- | --------------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` == true |
| `isCreated` | Indicates if the generated mock should have `isCreated` == true |
| `recordId` | The record ID to use within the mock result |
| Param | Description |
| ----------- | ------------------------------------------------------- |
| `isSuccess` | Indicates if the generated mock should have `isSuccess` |
| `isCreated` | Indicates if the generated mock should have `isCreated` |
| `recordId` | The record ID to use within the mock result |

##### Return

Expand Down
4 changes: 2 additions & 2 deletions docs/apex/Test-Utilities/LoggerTestConfigurator.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ Loads the mock `LogStatus_t` during test execution

#### `setupMockSObjectHandlerConfigurations()``void`

Creates mock instances of `LoggerSObjectHandler_t` for each `SObjectType` used by Nebula Logger, with each `LoggerSObjectHandler_t` automatically set to `IsEnabled__c == true`
Creates mock instances of `LoggerSObjectHandler_t` for each `SObjectType` used by Nebula Logger, with `IsEnabled__c` set to `true` on each `LoggerSObjectHandler_t` record

#### `setupMockSObjectHandlerConfigurations(Boolean isEnabled)``void`

Creates mock instances of `LoggerSObjectHandler_t` for each `SObjectType` used by Nebula Logger, with each `LoggerSObjectHandler_t` enabled/disabled based on the provided boolean
Creates mock instances of `LoggerSObjectHandler_t` for each `SObjectType` used by Nebula Logger, with `IsEnabled__c` set based on the provided boolean on each `LoggerSObjectHandler_t` record

##### Parameters

Expand Down
4 changes: 2 additions & 2 deletions nebula-logger/core/main/configuration/classes/LoggerCache.cls
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public without sharing class LoggerCache {
public void put(String key, Object value) {
this.transactionCache.put(key, value);

if (LoggerParameter.USE_PLATFORM_CACHE == true && this.cachePartitionDelegate.isAvailable() == true) {
if (LoggerParameter.USE_PLATFORM_CACHE && this.cachePartitionDelegate.isAvailable()) {
// Platform cache does not support storing null values, so a predefined value is used as a substitute
if (value == null) {
value = PLATFORM_CACHE_NULL_VALUE;
Expand All @@ -232,7 +232,7 @@ public without sharing class LoggerCache {
public void remove(String key) {
this.transactionCache.remove(key);

if (LoggerParameter.USE_PLATFORM_CACHE == true && this.cachePartitionDelegate.isAvailable() == true) {
if (LoggerParameter.USE_PLATFORM_CACHE && this.cachePartitionDelegate.isAvailable()) {
this.cachePartitionDelegate.remove(key);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ public class LoggerParameter {
public static List<LoggerParameter__mdt> matchOnPrefix(String developerNamePrefix) {
List<LoggerParameter__mdt> matchingParameters = new List<LoggerParameter__mdt>();
for (String parameterDeveloperName : DEVELOPER_NAME_TO_RECORD.keySet()) {
if (parameterDeveloperName.startsWith(developerNamePrefix) == true) {
if (parameterDeveloperName.startsWith(developerNamePrefix)) {
matchingParameters.add(DEVELOPER_NAME_TO_RECORD.get(parameterDeveloperName));
}
}
Expand All @@ -656,13 +656,13 @@ public class LoggerParameter {

private static Map<String, LoggerParameter__mdt> loadRecords() {
Map<String, LoggerParameter__mdt> parameters = LoggerParameter__mdt.getAll().clone();
if (System.Test.isRunningTest() == true) {
if (System.Test.isRunningTest()) {
// Keep a copy of any records that *should* be loaded during tests
// Currently, only the record `SystemDebugMessageFormat` has a use case for this functionality,
// but others can be easily added if other use cases are found
Map<String, LoggerParameter__mdt> parametersToLoadDuringTests = new Map<String, LoggerParameter__mdt>();
for (String testContextParameterName : PARAMETERS_TO_LOAD_DURING_TESTS) {
if (parameters.containsKey(testContextParameterName) == true) {
if (parameters.containsKey(testContextParameterName)) {
parametersToLoadDuringTests.put(testContextParameterName, parameters.get(testContextParameterName));
}
}
Expand All @@ -674,7 +674,7 @@ public class LoggerParameter {

@TestVisible
private static void setMock(LoggerParameter__mdt parameter) {
if (String.isBlank(parameter.DeveloperName) == true) {
if (String.isBlank(parameter.DeveloperName)) {
throw new System.IllegalArgumentException('DeveloperName is required on `LoggerParameter__mdt: \n' + JSON.serializePretty(parameter));
}

Expand Down
14 changes: 7 additions & 7 deletions nebula-logger/core/main/configuration/classes/LoggerPlugin.cls
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public without sharing class LoggerPlugin {
}

/**
* @description Returns all enabled `LoggerPlugin__mdt` records, based on `IsEnabled__c == true`
* @description Returns all enabled `LoggerPlugin__mdt` records (where `IsEnabled__c` is set to `true`)
* @return The list of enabled `LoggerPlugin__mdt` records
*/
public static List<LoggerPlugin__mdt> getPluginConfigurations() {
Expand All @@ -54,7 +54,7 @@ public without sharing class LoggerPlugin {
break;
}
}
if (matchesFilterFields == true) {
if (matchesFilterFields) {
matchingPluginConfigurationSorters.add(
new PluginConfigurationSorter(pluginConfiguration).sortBy(sortByField).sortBy(Schema.LoggerPlugin__mdt.DeveloperName)
);
Expand Down Expand Up @@ -105,22 +105,22 @@ public without sharing class LoggerPlugin {
private static Map<String, LoggerPlugin__mdt> loadEnabledRecords() {
Map<String, LoggerPlugin__mdt> pluginDeveloperNameToConfiguration = new Map<String, LoggerPlugin__mdt>();
for (LoggerPlugin__mdt pluginConfiguration : LoggerPlugin__mdt.getAll().values()) {
if (pluginConfiguration.IsEnabled__c == true) {
if (pluginConfiguration.IsEnabled__c) {
pluginDeveloperNameToConfiguration.put(pluginConfiguration.DeveloperName, pluginConfiguration);
}
}
if (System.Test.isRunningTest() == true) {
if (System.Test.isRunningTest()) {
pluginDeveloperNameToConfiguration.clear();
}
return pluginDeveloperNameToConfiguration;
}

@TestVisible
private static void setMock(LoggerPlugin__mdt pluginConfiguration) {
if (String.isBlank(pluginConfiguration.DeveloperName) == true) {
if (String.isBlank(pluginConfiguration.DeveloperName)) {
throw new System.IllegalArgumentException('DeveloperName is required on mock LoggerPlugin__mdt: \n' + JSON.serializePretty(pluginConfiguration));
}
if (pluginConfiguration.IsEnabled__c == true) {
if (pluginConfiguration.IsEnabled__c) {
DEVELOPER_NAME_TO_RECORD.put(pluginConfiguration.DeveloperName, pluginConfiguration);
}
}
Expand Down Expand Up @@ -154,7 +154,7 @@ public without sharing class LoggerPlugin {
// Now, the actual comparisons
if (this.pluginConfiguration.get(field) == that.pluginConfiguration.get(field)) {
continue;
} else if (this.pluginConfiguration.get(field) == null && that.pluginConfiguration.get(field) != null || thisIsGreaterThanThat == true) {
} else if (this.pluginConfiguration.get(field) == null && that.pluginConfiguration.get(field) != null || thisIsGreaterThanThat) {
return 1;
} else {
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ public without sharing class LoggerScenarioRule {

@TestVisible
private static void setMock(LoggerScenarioRule__mdt scenarioRule) {
if (String.isBlank(scenarioRule.Scenario__c) == true) {
if (String.isBlank(scenarioRule.Scenario__c)) {
throw new System.IllegalArgumentException('Scenario__c is required on `LoggerScenarioRule__mdt: \n' + JSON.serializePretty(scenarioRule));
}

if (isValid(scenarioRule) == true) {
if (isValid(scenarioRule)) {
SCENARIO_NAME_TO_SCENARIO_RULE.put(scenarioRule.Scenario__c, scenarioRule);
}
}

private static Map<String, LoggerScenarioRule__mdt> loadLogScenarioRules() {
Map<String, LoggerScenarioRule__mdt> scenarioRules = new Map<String, LoggerScenarioRule__mdt>();
for (LoggerScenarioRule__mdt scenarioRule : LoggerScenarioRule__mdt.getAll().values()) {
if (isValid(scenarioRule) == true) {
if (isValid(scenarioRule)) {
scenarioRules.put(scenarioRule.Scenario__c, scenarioRule);
}
}

if (System.Test.isRunningTest() == true) {
if (System.Test.isRunningTest()) {
scenarioRules.clear();
}

Expand All @@ -59,12 +59,12 @@ public without sharing class LoggerScenarioRule {

private static Boolean isValid(LoggerScenarioRule__mdt scenarioRule) {
Boolean isValid = false;
if (scenarioRule.IsEnabled__c == true) {
if (scenarioRule.IsEnabled__c) {
Datetime currentTime = System.now();
Boolean startTimeIsValid = scenarioRule.StartTime__c == null || scenarioRule.StartTime__c <= currentTime;
Boolean endTimeIsValid = scenarioRule.EndTime__c == null || scenarioRule.EndTime__c >= currentTime;

isValid = startTimeIsValid == true && endTimeIsValid == true;
isValid = startTimeIsValid && endTimeIsValid;
}
return isValid;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public with sharing class LogBatchPurgeController {
*/
@AuraEnabled
public static Boolean canUserRunLogBatchPurger() {
return Schema.Log__c.SObjectType.getDescribe().isDeletable() == true ||
System.FeatureManagement.checkPermission(CAN_EXECUTE_LOG_BATCH_PURGER_PERMISSION) == true;
return Schema.Log__c.SObjectType.getDescribe().isDeletable() || System.FeatureManagement.checkPermission(CAN_EXECUTE_LOG_BATCH_PURGER_PERMISSION);
}

/**
Expand Down
Loading

0 comments on commit 668f2d1

Please sign in to comment.