Skip to content

Commit 25d390e

Browse files
RubenHalmanjunners
authored andcommitted
include example false positive
1 parent 5a04866 commit 25d390e

File tree

2 files changed

+189
-0
lines changed

2 files changed

+189
-0
lines changed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<apiVersion>60.0</apiVersion>
4+
<assignments>
5+
<name>Set_Error_Message</name>
6+
<label>Set Error Message</label>
7+
<locationX>314</locationX>
8+
<locationY>350</locationY>
9+
<assignmentItems>
10+
<assignToReference>errorMessage</assignToReference>
11+
<operator>Assign</operator>
12+
<value>
13+
<stringValue>Error when retrieving records</stringValue>
14+
</value>
15+
</assignmentItems>
16+
</assignments>
17+
<decisions>
18+
<name>Check_object_type</name>
19+
<label>Check object type</label>
20+
<locationX>578</locationX>
21+
<locationY>134</locationY>
22+
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
23+
<rules>
24+
<name>User</name>
25+
<conditionLogic>and</conditionLogic>
26+
<conditions>
27+
<leftValueReference>recordId</leftValueReference>
28+
<operator>StartsWith</operator>
29+
<rightValue>
30+
<stringValue>005</stringValue>
31+
</rightValue>
32+
</conditions>
33+
<connector>
34+
<targetReference>Get_User</targetReference>
35+
</connector>
36+
<label>User</label>
37+
</rules>
38+
<rules>
39+
<name>Queue</name>
40+
<conditionLogic>and</conditionLogic>
41+
<conditions>
42+
<leftValueReference>recordId</leftValueReference>
43+
<operator>StartsWith</operator>
44+
<rightValue>
45+
<stringValue>00G</stringValue>
46+
</rightValue>
47+
</conditions>
48+
<connector>
49+
<targetReference>Get_Queue</targetReference>
50+
</connector>
51+
<label>Queue</label>
52+
</rules>
53+
</decisions>
54+
<description>Subflow that throws MissingNullHandler</description>
55+
<environments>Default</environments>
56+
<interviewLabel>Subflow_Missing {!$Flow.CurrentDateTime}</interviewLabel>
57+
<label>Subflow_MissingNullHandler</label>
58+
<processMetadataValues>
59+
<name>BuilderType</name>
60+
<value>
61+
<stringValue>LightningFlowBuilder</stringValue>
62+
</value>
63+
</processMetadataValues>
64+
<processMetadataValues>
65+
<name>CanvasMode</name>
66+
<value>
67+
<stringValue>AUTO_LAYOUT_CANVAS</stringValue>
68+
</value>
69+
</processMetadataValues>
70+
<processMetadataValues>
71+
<name>OriginBuilderType</name>
72+
<value>
73+
<stringValue>LightningFlowBuilder</stringValue>
74+
</value>
75+
</processMetadataValues>
76+
<processType>AutoLaunchedFlow</processType>
77+
<recordLookups>
78+
<name>Get_Queue</name>
79+
<label>Get Queue</label>
80+
<locationX>578</locationX>
81+
<locationY>242</locationY>
82+
<assignNullValuesIfNoRecordsFound>true</assignNullValuesIfNoRecordsFound>
83+
<faultConnector>
84+
<isGoTo>true</isGoTo>
85+
<targetReference>Set_Error_Message</targetReference>
86+
</faultConnector>
87+
<filterLogic>and</filterLogic>
88+
<filters>
89+
<field>Type</field>
90+
<operator>EqualTo</operator>
91+
<value>
92+
<stringValue>Queue</stringValue>
93+
</value>
94+
</filters>
95+
<filters>
96+
<field>Id</field>
97+
<operator>EqualTo</operator>
98+
<value>
99+
<elementReference>recordId</elementReference>
100+
</value>
101+
</filters>
102+
<object>Group</object>
103+
<outputReference>queueRecord</outputReference>
104+
<queriedFields>Id</queriedFields>
105+
</recordLookups>
106+
<recordLookups>
107+
<name>Get_User</name>
108+
<label>Get User</label>
109+
<locationX>50</locationX>
110+
<locationY>242</locationY>
111+
<assignNullValuesIfNoRecordsFound>true</assignNullValuesIfNoRecordsFound>
112+
<faultConnector>
113+
<targetReference>Set_Error_Message</targetReference>
114+
</faultConnector>
115+
<filterLogic>and</filterLogic>
116+
<filters>
117+
<field>Id</field>
118+
<operator>EqualTo</operator>
119+
<value>
120+
<elementReference>recordId</elementReference>
121+
</value>
122+
</filters>
123+
<object>User</object>
124+
<outputReference>userRecord</outputReference>
125+
<queriedFields>Id</queriedFields>
126+
</recordLookups>
127+
<start>
128+
<locationX>452</locationX>
129+
<locationY>0</locationY>
130+
<connector>
131+
<targetReference>Check_object_type</targetReference>
132+
</connector>
133+
</start>
134+
<status>Draft</status>
135+
<variables>
136+
<name>errorMessage</name>
137+
<dataType>String</dataType>
138+
<isCollection>false</isCollection>
139+
<isInput>false</isInput>
140+
<isOutput>true</isOutput>
141+
</variables>
142+
<variables>
143+
<name>queueRecord</name>
144+
<dataType>SObject</dataType>
145+
<isCollection>false</isCollection>
146+
<isInput>false</isInput>
147+
<isOutput>true</isOutput>
148+
<objectType>Group</objectType>
149+
</variables>
150+
<variables>
151+
<name>recordId</name>
152+
<dataType>String</dataType>
153+
<isCollection>false</isCollection>
154+
<isInput>true</isInput>
155+
<isOutput>false</isOutput>
156+
</variables>
157+
<variables>
158+
<name>userRecord</name>
159+
<dataType>SObject</dataType>
160+
<isCollection>false</isCollection>
161+
<isInput>false</isInput>
162+
<isOutput>true</isOutput>
163+
<objectType>User</objectType>
164+
</variables>
165+
</Flow>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { describe, expect, it } from "@jest/globals";
2+
import * as path from "path";
3+
4+
import * as core from "../src";
5+
6+
describe("MissingNullHandler ", () => {
7+
const example_uri = path.join(
8+
__dirname,
9+
"../example-flows/force-app/main/default/flows/No_Missing_Null_Handler.flow-meta.flow-meta.xml"
10+
);
11+
it("should not return a result ", async () => {
12+
const flows = await core.parse([example_uri]);
13+
const ruleConfig = {
14+
rules: {
15+
MissingNullHandler: {
16+
severity: "error",
17+
},
18+
},
19+
};
20+
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
21+
expect(results[0].ruleResults[0].ruleName).toBe("MissingNullHandler");
22+
expect(results[0].ruleResults[0].occurs).toBe(false);
23+
});
24+
});

0 commit comments

Comments
 (0)