Skip to content

Commit c8e9b25

Browse files
authored
refactor: soql keywords cleanup (#32)
test: add page to view expected markup test code test: add sample soql file fix: remove unnecessary system interfaces
1 parent 4483ee6 commit c8e9b25

File tree

7 files changed

+320
-218
lines changed

7 files changed

+320
-218
lines changed

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
!dist/**/*
44
!package.json
55
!src/**/*
6-
!test/**/*
6+
!test/**/*
7+
!assets/*

demo/markupcheck.html

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>Apex Markup Check</title>
5+
<meta charset="UTF-8" />
6+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.js"></script>
7+
<script charset="UTF-8" src="../dist/apex.min.js"></script>
8+
<link rel="stylesheet" href="./testcode.css" />
9+
<!-- <link rel="stylesheet" href="../src/styles/monokai-sublime-apex.css" /> -->
10+
<link rel="stylesheet" href="vs.css" />
11+
<script>
12+
hljs.debugMode();
13+
hljs.highlightAll();
14+
</script>
15+
<style>
16+
pre code {
17+
white-space: pre-wrap;
18+
font-size: 120%;
19+
}
20+
</style>
21+
</head>
22+
23+
<body>
24+
<pre><code class="language-apex">
25+
/**
26+
* @author John Smith
27+
*/
28+
@IsTest(Seealldata=true)
29+
public with sharing class L2Char implements Database.batchable {
30+
public static final String ERROR = 0x0001;
31+
32+
@InvocableMethod(label='my invocable')
33+
public static void moveTo(
34+
Integer x,
35+
Integer y,
36+
Integer z
37+
) {
38+
39+
40+
Account a = new Account();
41+
a.Custom__c = 'stringvalue';
42+
insert a;
43+
Boolean ai = (Boolean) false;
44+
System.debug('Should not be called');
45+
if (1 &gt; 5 && !Test.isRunningTest()) { // wtf!?
46+
Database.insert(myAccounts, false);
47+
}
48+
}
49+
50+
@TestSetup
51+
private static void makeData(Boolean a){
52+
Custom__c c = new Custom__c();
53+
54+
for(Account a : acctLis ){
55+
ConnectApi.insert a;
56+
}
57+
}
58+
59+
@isTest
60+
private static void testme(){
61+
System.assert(true);
62+
}
63+
64+
@testVisible
65+
private List&lt;SelectOption&gt; recordTypes { get; private set; }
66+
67+
for(Account a : [SELECT Id FROM Account WHERE LastModifiedDate = LAST_N_DAYS:3]){
68+
Assert.fail();
69+
}
70+
}
71+
72+
trigger CTrig on Custom__c (before insert){
73+
System.debug('inserting a record');
74+
upsert myRecord__c;
75+
}
76+
</code></pre>
77+
</body>
78+
</html>

demo/soqlsamples.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[SELECT
2+
Account.Name,
3+
(SELECT FIELDS(ALL) FROM Account.Contacts LIMIT 200)
4+
FROM Account]
5+
6+
[SELECT Id, FIELDS(ALL) FROM User LIMIT 200]
7+
[SELECT
8+
TYPEOF What
9+
WHEN Account THEN Phone
10+
ELSE Name
11+
END
12+
FROM Event
13+
WHERE CreatedById IN
14+
(
15+
SELECT CreatedById
16+
FROM Case
17+
)]
18+
[SELECT
19+
TYPEOF What
20+
WHEN Account THEN Id, LastModifiedDate
21+
WHEN Opportunity THEN Id
22+
END
23+
FROM Task]
24+
[SELECT
25+
TYPEOF What
26+
WHEN Account THEN Phone, NumberOfEmployees
27+
WHEN Opportunity THEN Amount, CloseDate
28+
ELSE Name, Email
29+
END
30+
FROM Event]
31+
[SELECT Id, (SELECT Id from OpportunityLineItems)
32+
FROM Opportunity
33+
WHERE Id IN
34+
(
35+
SELECT OpportunityId
36+
FROM OpportunityLineItem
37+
WHERE totalPrice > 10000
38+
)]
39+
[SELECT Id FROM Account WHERE CreatedDate = NEXT_N_FISCAL_QUARTERS:6]
40+
[SELECT Id FROM Opportunity WHERE CloseDate = N_WEEKS_AGO:3]
41+
[SELECT Id FROM Account WHERE CreatedDate = YESTERDAY]
42+
[SELECT Id, MSP1__c from CustObj__c WHERE MSP1__c includes ('AAA;BBB','CCC')]
43+
[SELECT Id
44+
FROM Case
45+
WHERE Contact.LastName = null]
46+
[SELECT Title FROM Question WHERE LastReplyDate > 2005-10-08T01:02:03Z WITH DATA CATEGORY Geography__c AT (usa__c, uk__c)]
47+
[SELECT LeadSource, COUNT(Name) cnt
48+
FROM Lead
49+
GROUP BY ROLLUP(LeadSource)]
50+
[SELECT LeadSource, COUNT(Name) cnt
51+
FROM Lead
52+
GROUP BY ROLLUP(LeadSource)]
53+
[SELECT Name, MAX(Amount), MIN(Amount) min, SUM(Amount)
54+
FROM Opportunity
55+
GROUP BY Name]
56+
[SELECT LeadSource, Rating,
57+
GROUPING(LeadSource) grpLS, GROUPING(Rating) grpRating,
58+
COUNT(Name) cnt
59+
FROM Lead
60+
GROUP BY ROLLUP(LeadSource, Rating)]

0 commit comments

Comments
 (0)