Skip to content

Commit 9f777d6

Browse files
committed
Fix PMD warnings
1 parent 41a54d9 commit 9f777d6

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
*
7777
*/
7878
@SuppressWarnings(
79-
'PMD.CognitiveComplexity, PMD.StdCyclomaticComplexity, PMD.CyclomaticComplexity'
79+
'PMD.CognitiveComplexity,PMD.StdCyclomaticComplexity,PMD.CyclomaticComplexity'
8080
)
8181
public inherited sharing class MetadataTriggerHandler extends TriggerBase implements TriggerAction.BeforeInsert, TriggerAction.AfterInsert, TriggerAction.BeforeUpdate, TriggerAction.AfterUpdate, TriggerAction.BeforeDelete, TriggerAction.AfterDelete, TriggerAction.AfterUndelete {
8282
private static final String DOUBLE_UNDERSCORE = '__';

trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
@SuppressWarnings(
18-
'PMD.ApexDoc, PMD.CyclomaticComplexity, PMD.ApexUnitTestClassShouldHaveRunAs'
18+
'PMD.ApexDoc,PMD.CyclomaticComplexity,PMD.ApexUnitTestClassShouldHaveRunAs'
1919
)
2020
@IsTest(isParallel=true)
2121
private class MetadataTriggerHandlerTest {

trigger-actions-framework/main/default/classes/TriggerActionFlow.cls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @description This class implements the TriggerAction interface and provides a framework for
2020
* executing Flows before or after the insert, update, delete, or undelete of records.
2121
*/
22-
@SuppressWarnings('PMD.CyclomaticComplexity, PMD.CognitiveComplexity')
22+
@SuppressWarnings('PMD.CyclomaticComplexity,PMD.CognitiveComplexity')
2323
public virtual inherited sharing class TriggerActionFlow implements TriggerAction.BeforeInsert, TriggerAction.AfterInsert, TriggerAction.BeforeUpdate, TriggerAction.AfterUpdate, TriggerAction.BeforeDelete, TriggerAction.AfterDelete, TriggerAction.AfterUndelete {
2424
@TestVisible
2525
private static final String RECORD_VARIABLE_NOT_FOUND_ERROR = 'There must be a variable defined in this flow with api name of "record" and type of "record" that is marked as "available for output"';
@@ -449,6 +449,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio
449449
}
450450
}
451451

452+
@SuppressWarnings('PMD.ApexDoc')
452453
@TestVisible
453454
private virtual class NameExtractor {
454455
public virtual String extractName(System.Type flowType) {

trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
@SuppressWarnings(
18-
'PMD.ApexDoc, PMD.ApexUnitTestClassShouldHaveRunAs, PMD.CyclomaticComplexity'
18+
'PMD.ApexDoc,PMD.ApexUnitTestClassShouldHaveRunAs,PMD.CyclomaticComplexity'
1919
)
2020
@IsTest(isParallel=true)
2121
private class TriggerActionFlowTest {
@@ -568,6 +568,7 @@ private class TriggerActionFlowTest {
568568
this.outputParameters = outputParameters;
569569
return this;
570570
}
571+
@SuppressWarnings('PMD.AvoidBooleanMethodParameters')
571572
public InvocableActionResultBuilder setSuccess(Boolean success) {
572573
this.success = success;
573574
return this;

trigger-actions-framework/main/default/classes/TriggerBase.cls

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* The `TriggerAction` interface defines the methods that should be implemented by trigger actions.
3434
*/
3535
@SuppressWarnings(
36-
'PMD.StdCyclomaticComplexity, PMD.CyclomaticComplexity, PMD.CognitiveComplexity, PMD.PropertyNamingConventions'
36+
'PMD.StdCyclomaticComplexity,PMD.CyclomaticComplexity,PMD.CognitiveComplexity,PMD.PropertyNamingConventions'
3737
)
3838
public inherited sharing virtual class TriggerBase {
3939
@TestVisible
@@ -142,7 +142,9 @@ public inherited sharing virtual class TriggerBase {
142142
* @param sObjectType The sObjectType of the object to bypass.
143143
*/
144144
public static void bypass(Schema.sObjectType sObjectType) {
145-
TriggerBase.bypassedObjects.add(sObjectType.getDescribe().getName());
145+
TriggerBase.bypassedObjects.add(
146+
sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getName()
147+
);
146148
}
147149

148150
/**
@@ -151,7 +153,9 @@ public inherited sharing virtual class TriggerBase {
151153
* @param sObjectType The sObjectType of the object to clear the bypass for.
152154
*/
153155
public static void clearBypass(Schema.sObjectType sObjectType) {
154-
TriggerBase.bypassedObjects.remove(sObjectType.getDescribe().getName());
156+
TriggerBase.bypassedObjects.remove(
157+
sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getName()
158+
);
155159
}
156160

157161
/**
@@ -162,7 +166,7 @@ public inherited sharing virtual class TriggerBase {
162166
*/
163167
public static Boolean isBypassed(Schema.sObjectType sObjectType) {
164168
return TriggerBase.bypassedObjects.contains(
165-
sObjectType.getDescribe().getName()
169+
sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getName()
166170
);
167171
}
168172

trigger-actions-framework/main/default/classes/TriggerBaseTest.cls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
limitations under the License.
1515
*/
1616

17-
@SuppressWarnings('PMD.ApexDoc, PMD.ApexUnitTestClassShouldHaveRunAs')
17+
@SuppressWarnings(
18+
'PMD.ApexDoc,PMD.CyclomaticComplexity,PMD.ApexUnitTestClassShouldHaveRunAs'
19+
)
1820
@IsTest(isParallel=true)
1921
private class TriggerBaseTest {
2022
private static final String ACCOUNT = 'Account';

0 commit comments

Comments
 (0)