pmd-ruleset-visualizer 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -2
- package/package.json +42 -4
- package/public/app.js +1 -0
- package/public/index.html +236 -0
- package/public/sample-ruleset.xml +214 -0
- package/public/styles.css +310 -0
- package/server.js +2 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
3
|
+
<title>PMD Ruleset Visualizer</title>
|
|
4
|
+
<link rel="icon" type="image/x-icon" href="https://mohan-chinnappan-n5.github.io/dfv/img/mc_favIcon.ico">
|
|
5
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
6
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@700&display=swap">
|
|
7
|
+
<link rel="stylesheet" href="/styles.css">
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.4/dist/chart.umd.min.js"></script></head>
|
|
9
|
+
<body>
|
|
10
|
+
<header class="topbar"><a class="brand" href="#"><span class="mark">P</span> PMD <b>Ruleset Visualizer</b></a>
|
|
11
|
+
<div class="actions"><span class="local"><i></i> Local-first</span><button class="ghost" id="sampleBtn">Load sample</button>
|
|
12
|
+
<label class="primary upload">↑ Open ruleset<input id="fileInput" type="file" accept=".xml,.ruleset,text/xml"></label>
|
|
13
|
+
<button class="theme-btn" id="themeBtn" title="Toggle dark mode">☽</button>
|
|
14
|
+
<button class="tour-btn" id="tourBtn" title="Guided tour">◉</button>
|
|
15
|
+
<button class="settings-trigger" id="settingsOpenBtn" title="Settings">⚙</button></div></header>
|
|
16
|
+
<main class="shell">
|
|
17
|
+
<section class="intro"><div><div class="eyebrow">STATIC ANALYSIS · SALESFORCE APEX</div><h1>Understand your ruleset<br><em>at a glance.</em></h1>
|
|
18
|
+
<p>Explore rule coverage, compare versions, inspect PMD references and edit your ruleset visually.</p></div>
|
|
19
|
+
<div class="art"><div class="ring r1"></div><div class="ring r2"></div><div class="core">XML</div><span class="node n1">RULE</span><span class="node n2">APEX</span><span class="node n3">PMD</span></div></section>
|
|
20
|
+
<section class="input-panel">
|
|
21
|
+
<div class="panel-head"><div><h2>Load a ruleset</h2><p>Upload a file or paste your ruleset XML below.</p></div>
|
|
22
|
+
<div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap">
|
|
23
|
+
<select id="presetSelect"><option value="">Load a preset…</option><option value="apex-security">Apex – Security</option><option value="apex-bestpractices">Apex – Best Practices</option><option value="apex-performance">Apex – Performance</option><option value="apex-all">Apex – All Categories</option></select>
|
|
24
|
+
<small>XML · RULESET · MAX 2 MB</small></div></div>
|
|
25
|
+
<textarea id="xmlInput" spellcheck="false" placeholder="<?xml version="1.0"?> <ruleset name="my-ruleset"> ... </ruleset>"></textarea>
|
|
26
|
+
<div class="input-foot"><span id="inputStatus">Your XML is processed on this machine.</span><button class="primary" id="visualizeBtn">Visualize ruleset →</button></div>
|
|
27
|
+
<div id="errorBox" class="error" hidden></div></section>
|
|
28
|
+
<section id="results" hidden>
|
|
29
|
+
<div class="result-head"><div><div class="eyebrow">RULESET OVERVIEW</div><h2 id="rulesetName"></h2><p id="rulesetDescription"></p></div>
|
|
30
|
+
<div class="head-actions">
|
|
31
|
+
<button class="ghost" id="vsDefaultBtn">⇄ vs PMD Default</button>
|
|
32
|
+
<button class="ghost" id="shareBtn">⇗ Share link</button>
|
|
33
|
+
<button class="ghost" id="exportBtn">↓ Export edited XML</button>
|
|
34
|
+
<button class="ghost" id="clearBtn">Clear</button></div></div>
|
|
35
|
+
<div class="stats">
|
|
36
|
+
<article><small>ACTIVE RULES</small><strong id="activeCount">0</strong><span>Enabled rules</span></article>
|
|
37
|
+
<article><small>CATEGORIES</small><strong id="groupCount">0</strong><span>Rule groups</span></article>
|
|
38
|
+
<article><small>COMMENTED OUT</small><strong id="commentedCount">0</strong><span>Found in XML comments</span></article>
|
|
39
|
+
<article><small>PRIORITY 3</small><strong id="priority3Count">0</strong><span>Normal PMD priority</span></article></div>
|
|
40
|
+
<div class="tool-strip">
|
|
41
|
+
<button class="tool-tab active" data-tab="explore">◈ Rule explorer</button>
|
|
42
|
+
<button class="tool-tab" data-tab="graph">⌘ Category graph</button>
|
|
43
|
+
<button class="tool-tab" data-tab="health">▥ Rule health</button>
|
|
44
|
+
<button class="tool-tab" data-tab="compare">⇄ Compare rulesets</button>
|
|
45
|
+
<button class="tool-tab" data-tab="catalog">✓ Validate catalog</button>
|
|
46
|
+
<button class="tool-tab" data-tab="treemap">⬛ Treemap</button>
|
|
47
|
+
<button class="tool-tab" data-tab="merge">⊕ Merge</button>
|
|
48
|
+
<button class="tool-tab" data-tab="run">▶ Run PMD</button></div>
|
|
49
|
+
<div id="explorePanel" class="tab-panel">
|
|
50
|
+
<div class="workspace"><aside class="sidebar"><div class="side-label">EXPLORE</div>
|
|
51
|
+
<button class="nav selected" data-view="all">▦ All active rules <b id="navAllCount">0</b></button>
|
|
52
|
+
<button class="nav" data-view="commented">◌ Commented out <b id="navCommentCount">0</b></button>
|
|
53
|
+
<hr><div class="side-label">CATEGORIES</div><div id="categoryNav"></div></aside>
|
|
54
|
+
<div class="content">
|
|
55
|
+
<div class="toolbar"><div><h3 id="viewTitle">All active rules</h3><p id="viewSubtitle"></p></div>
|
|
56
|
+
<div class="controls">
|
|
57
|
+
<label class="select-all-wrap"><input type="checkbox" id="selectAllCb"> All</label>
|
|
58
|
+
<label class="search">⌕ <input id="searchInput" placeholder="Search rules..." type="search"></label>
|
|
59
|
+
<select id="priorityFilter"><option value="all">All priorities</option><option value="1">Priority 1</option><option value="2">Priority 2</option><option value="3">Priority 3</option><option value="4">Priority 4</option><option value="5">Priority 5</option><option value="unset">Unset</option></select>
|
|
60
|
+
<div class="toggle"><button class="active" data-layout="cards">▦</button><button data-layout="list">☷</button></div></div></div>
|
|
61
|
+
<div id="categoryCards" class="category-cards"></div>
|
|
62
|
+
<div id="ruleGrid" class="rule-grid"></div>
|
|
63
|
+
<div id="emptyState" class="empty" hidden><h3>No matching rules</h3><p>Try another search or filter.</p></div>
|
|
64
|
+
<div id="bulkBar" class="hidden">
|
|
65
|
+
<span id="bulkCount">0 rules selected</span>
|
|
66
|
+
<span style="color:var(--muted)">·</span>
|
|
67
|
+
<span style="font-size:11px">Priority:</span>
|
|
68
|
+
<select id="bulkPriority"><option value="">Unset</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select>
|
|
69
|
+
<button class="ghost" id="bulkEnableBtn">Enable</button>
|
|
70
|
+
<button class="ghost" id="bulkDisableBtn">Disable</button>
|
|
71
|
+
<button class="ghost" id="bulkSetPriBtn">Set Priority</button>
|
|
72
|
+
<button class="ghost" id="bulkClearBtn">✕ Clear</button>
|
|
73
|
+
</div>
|
|
74
|
+
</div></div>
|
|
75
|
+
<section id="commentedSection" class="commented" hidden><div class="eyebrow">NOT CURRENTLY ENFORCED</div><h3>Commented-out rules</h3><p>References inside XML comments; these are not active PMD rules.</p><div id="commentedList" class="chips"></div></section></div>
|
|
76
|
+
<div id="graphPanel" class="tab-panel" hidden>
|
|
77
|
+
<div class="section-heading"><div><h3>Category & priority charts</h3><p>Visual breakdown of rule distribution across categories and priority levels.</p></div></div>
|
|
78
|
+
<div class="chart-row">
|
|
79
|
+
<div class="chart-box"><canvas id="catChart"></canvas></div>
|
|
80
|
+
<div class="chart-box"><canvas id="priChart"></canvas></div>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="section-heading" style="margin-top:8px"><div><h3>Category → rule map</h3><p>Each category node expands into its configured PMD rules.</p></div></div>
|
|
83
|
+
<div id="graphView" class="graph-view"></div></div>
|
|
84
|
+
<div id="healthPanel" class="tab-panel" hidden>
|
|
85
|
+
<div class="section-heading"><div><h3>Rule health & coverage</h3><p>A quick structural view of the checks currently configured. This is not a runtime PMD scan.</p></div></div>
|
|
86
|
+
<div id="healthView"></div></div>
|
|
87
|
+
<div id="comparePanel" class="tab-panel" hidden>
|
|
88
|
+
<div class="section-heading"><div><h3>Compare another ruleset</h3><p>Choose a second XML file to identify added, removed and changed rules.</p></div></div>
|
|
89
|
+
<div class="compare-upload"><label class="primary upload">Choose comparison XML<input id="compareFile" type="file" accept=".xml,.ruleset,text/xml"></label><span id="compareFileName">No comparison file selected</span></div>
|
|
90
|
+
<div id="compareView"></div></div>
|
|
91
|
+
<div id="catalogPanel" class="tab-panel" hidden>
|
|
92
|
+
<div class="section-heading"><div><h3>Validate PMD rule references</h3><p>Optionally load a PMD catalog XML (such as category/apex/security.xml) from your installed PMD version.</p></div></div>
|
|
93
|
+
<div class="compare-upload"><label class="primary upload">Load catalog XML<input id="catalogFile" type="file" accept=".xml,text/xml"></label><span id="catalogFileName">No catalog loaded</span></div>
|
|
94
|
+
<div id="catalogView"></div></div>
|
|
95
|
+
<div id="treemapPanel" class="tab-panel" hidden>
|
|
96
|
+
<div class="section-heading"><div><h3>Ruleset treemap</h3><p>Rectangle area is proportional to rule count. Click a category to explore its rules.</p></div></div>
|
|
97
|
+
<div class="chart-box" style="height:400px;padding:0;overflow:hidden;border-radius:10px">
|
|
98
|
+
<svg id="treemapSvg" width="100%" height="400" style="display:block"></svg>
|
|
99
|
+
</div></div>
|
|
100
|
+
<div id="mergePanel" class="tab-panel" hidden>
|
|
101
|
+
<div class="section-heading"><div><h3>Import & merge ruleset</h3><p>Load a second ruleset and merge its rules into the current one. Duplicates are flagged.</p></div></div>
|
|
102
|
+
<div class="compare-upload">
|
|
103
|
+
<label class="primary upload">Choose XML to merge<input id="mergeFile" type="file" accept=".xml,.ruleset,text/xml"></label>
|
|
104
|
+
<span id="mergeFileName">No file selected</span>
|
|
105
|
+
<button class="ghost" id="mergeBtn" disabled>Merge into current →</button></div>
|
|
106
|
+
<div id="mergePreview"></div></div>
|
|
107
|
+
<div id="runPanel" class="tab-panel" hidden>
|
|
108
|
+
<div class="section-heading" style="display:flex;justify-content:space-between;align-items:flex-start">
|
|
109
|
+
<div><h3>Run PMD analysis</h3><p>Execute PMD against your source files using the loaded ruleset.</p></div>
|
|
110
|
+
<button class="ghost" id="runOpenSettingsBtn" style="white-space:nowrap;flex-shrink:0">⚙ Settings</button>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="run-config">
|
|
113
|
+
<label class="set-label" style="flex:1">Source directory or file path
|
|
114
|
+
<input id="runSourcePath" type="text" placeholder="/path/to/apex/classes" spellcheck="false">
|
|
115
|
+
</label>
|
|
116
|
+
<button class="primary" id="runPmdBtn">▶ Run PMD</button>
|
|
117
|
+
</div>
|
|
118
|
+
<div id="runStatus" hidden></div>
|
|
119
|
+
<div id="runChartsRow" class="chart-row" hidden>
|
|
120
|
+
<div class="chart-box" style="height:240px"><canvas id="runPriChart"></canvas></div>
|
|
121
|
+
<div class="chart-box" style="height:240px"><canvas id="runRuleChart"></canvas></div>
|
|
122
|
+
</div>
|
|
123
|
+
<div id="runResultsToolbar" class="run-results-toolbar" hidden>
|
|
124
|
+
<button id="exportXlsxBtn" class="ghost">↓ Export XLSX</button>
|
|
125
|
+
</div>
|
|
126
|
+
<div id="runResults"></div>
|
|
127
|
+
</div>
|
|
128
|
+
</section>
|
|
129
|
+
<footer><span>PMD Ruleset Visualizer</span><span>Local-first · XML stays in your browser / local Node process · Press ? for keyboard shortcuts</span></footer></main>
|
|
130
|
+
<dialog id="detailDialog"><div class="dialog-head"><div><div class="eyebrow">RULE DETAILS</div><h2 id="detailName"></h2></div><button id="closeDialog">×</button></div>
|
|
131
|
+
<div class="detail-body"><div id="detailMeta" class="meta"></div><p id="detailMessage"></p>
|
|
132
|
+
<h4>PMD REFERENCE</h4><code id="detailRef"></code>
|
|
133
|
+
<a id="detailDocsLink" class="docs-link" href="#" target="_blank" rel="noopener" hidden style="display:none">View PMD documentation ↗</a>
|
|
134
|
+
<h4>PROPERTIES</h4><div id="detailProperties"></div>
|
|
135
|
+
<h4>EDIT RULE</h4><div class="edit-row"><label>Priority <select id="editPriority"><option value="">Unset</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option></select></label><label class="check-label"><input id="editEnabled" type="checkbox"> Enabled</label></div><button class="primary" id="saveRule">Apply changes</button></div></dialog>
|
|
136
|
+
<!-- save-as-default dialog -->
|
|
137
|
+
<div id="saveDefaultOverlay" class="save-default-overlay hidden" role="dialog" aria-modal="true" aria-labelledby="saveDefaultTitle">
|
|
138
|
+
<div class="save-default-card">
|
|
139
|
+
<div class="save-default-icon">💾</div>
|
|
140
|
+
<h3 id="saveDefaultTitle">Save as default ruleset?</h3>
|
|
141
|
+
<p id="saveDefaultMsg">Load this ruleset automatically every time you open the app?</p>
|
|
142
|
+
<div class="save-default-path-row">
|
|
143
|
+
<label for="saveDefaultPathInput">Full file path</label>
|
|
144
|
+
<input id="saveDefaultPathInput" type="text" placeholder="/Users/you/my-ruleset.xml" autocomplete="off" spellcheck="false">
|
|
145
|
+
<span class="save-default-path-hint">The server will read this path on startup.</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="save-default-actions">
|
|
148
|
+
<button id="saveDefaultYes" class="primary">Save as default</button>
|
|
149
|
+
<button id="saveDefaultNo">No thanks</button>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
<!-- ── Splash screen ── -->
|
|
154
|
+
<div id="splashScreen" class="splash-screen">
|
|
155
|
+
<div class="splash-content">
|
|
156
|
+
<div class="splash-mark">P</div>
|
|
157
|
+
<h1 class="splash-title">PMD Ruleset Visualizer</h1>
|
|
158
|
+
<p class="splash-sub">Explore · Visualize · Run · Export</p>
|
|
159
|
+
<span class="splash-ver">v1.0</span>
|
|
160
|
+
<div class="splash-btns">
|
|
161
|
+
<button id="splashTour" class="splash-btn-primary">Start Tour ▶</button>
|
|
162
|
+
<button id="splashSkip" class="splash-btn-ghost">Get Started →</button>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="splash-progress-bar"></div>
|
|
166
|
+
</div>
|
|
167
|
+
<!-- ── Guided tour overlay + tooltip ── -->
|
|
168
|
+
<div id="tourOverlay" class="tour-overlay hidden"></div>
|
|
169
|
+
<div id="tourTip" class="tour-tip hidden" role="dialog" aria-live="polite">
|
|
170
|
+
<div class="tour-tip-header">
|
|
171
|
+
<span id="tourCounter" class="tour-counter"></span>
|
|
172
|
+
<button id="tourClose" class="tour-close" title="End tour">✕</button>
|
|
173
|
+
</div>
|
|
174
|
+
<h3 id="tourTitle" class="tour-tip-title"></h3>
|
|
175
|
+
<p id="tourText" class="tour-tip-text"></p>
|
|
176
|
+
<div class="tour-tip-footer">
|
|
177
|
+
<button id="tourPrev" class="tour-prev ghost">← Prev</button>
|
|
178
|
+
<div class="tour-dots" id="tourDots"></div>
|
|
179
|
+
<button id="tourNext" class="tour-next primary">Next →</button>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
<div id="toast"></div>
|
|
183
|
+
<div id="kbdHelp"><b style="display:block;margin-bottom:5px">Keyboard shortcuts</b>/ search j/k navigate e open detail Esc close ? this help</div>
|
|
184
|
+
<div id="settingsOverlay" class="settings-overlay hidden"></div>
|
|
185
|
+
<div id="settingsPanel" class="settings-panel">
|
|
186
|
+
<div class="settings-head">
|
|
187
|
+
<h3>Settings</h3>
|
|
188
|
+
<button id="settingsCloseBtn">×</button>
|
|
189
|
+
</div>
|
|
190
|
+
<div class="settings-body">
|
|
191
|
+
<p class="eyebrow" style="margin:0 0 8px">PMD CONFIGURATION</p>
|
|
192
|
+
<label class="set-label">PMD binary path
|
|
193
|
+
<input id="setPmdBin" type="text" placeholder="/path/to/pmd/bin/pmd" spellcheck="false">
|
|
194
|
+
</label>
|
|
195
|
+
<label class="set-label">Default source directory
|
|
196
|
+
<input id="setSourcePath" type="text" placeholder="/path/to/apex/classes" spellcheck="false">
|
|
197
|
+
</label>
|
|
198
|
+
<label class="set-label">Force language
|
|
199
|
+
<select id="setLanguage">
|
|
200
|
+
<option value="">Auto-detect</option>
|
|
201
|
+
<option value="apex">Apex</option>
|
|
202
|
+
<option value="java">Java</option>
|
|
203
|
+
<option value="javascript">JavaScript</option>
|
|
204
|
+
<option value="xml">XML</option>
|
|
205
|
+
</select>
|
|
206
|
+
</label>
|
|
207
|
+
<label class="set-label">Minimum priority
|
|
208
|
+
<select id="setMinPriority">
|
|
209
|
+
<option value="HIGH">High — P1 only</option>
|
|
210
|
+
<option value="MEDIUM_HIGH">Medium High — P1–P2</option>
|
|
211
|
+
<option value="MEDIUM">Medium — P1–P3</option>
|
|
212
|
+
<option value="MEDIUM_LOW">Medium Low — P1–P4</option>
|
|
213
|
+
<option value="LOW" selected>Low — all priorities</option>
|
|
214
|
+
</select>
|
|
215
|
+
</label>
|
|
216
|
+
<label class="set-label">Default ruleset path <span style="font-weight:400;font-style:italic">(auto-loaded on start)</span>
|
|
217
|
+
<input id="setDefaultRuleset" type="text" placeholder="/path/to/ruleset.xml" spellcheck="false">
|
|
218
|
+
</label>
|
|
219
|
+
<button class="primary" id="saveSettingsBtn">Save settings</button>
|
|
220
|
+
<p class="health-note" style="margin-top:10px">Settings are stored in your browser's local storage.</p>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
<div id="codeViewOverlay" class="settings-overlay hidden"></div>
|
|
224
|
+
<div id="codeViewPanel" class="code-view-panel">
|
|
225
|
+
<div class="cv-resize-handle" id="cvResizeHandle"></div>
|
|
226
|
+
<div class="code-view-head">
|
|
227
|
+
<div style="min-width:0">
|
|
228
|
+
<div class="eyebrow">APEX SOURCE</div>
|
|
229
|
+
<div id="codeViewFileName" class="code-view-title" title=""></div>
|
|
230
|
+
</div>
|
|
231
|
+
<button id="codeViewClose" title="Close">×</button>
|
|
232
|
+
</div>
|
|
233
|
+
<div id="codeViewViolationList" class="code-view-violations"></div>
|
|
234
|
+
<div id="monacoContainer" class="monaco-container"></div>
|
|
235
|
+
</div>
|
|
236
|
+
<script src="/app.js"></script></body></html>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<ruleset name="quickstart"
|
|
3
|
+
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
|
4
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
5
|
+
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
|
6
|
+
<description>Quickstart configuration of PMD for Salesforce.com Apex. Includes the rules that are most likely to apply everywhere.</description>
|
|
7
|
+
|
|
8
|
+
<!-- COMPLEXITY -->
|
|
9
|
+
<rule ref="category/apex/design.xml/ExcessiveClassLength" message="Avoid really long classes (lines of code)">
|
|
10
|
+
<priority>3</priority>
|
|
11
|
+
<properties>
|
|
12
|
+
<property name="minimum" value="1000" />
|
|
13
|
+
</properties>
|
|
14
|
+
</rule>
|
|
15
|
+
<rule ref="category/apex/design.xml/ExcessiveParameterList" message="Avoid long parameter lists">
|
|
16
|
+
<priority>3</priority>
|
|
17
|
+
<properties>
|
|
18
|
+
<property name="minimum" value="4" />
|
|
19
|
+
</properties>
|
|
20
|
+
</rule>
|
|
21
|
+
<rule ref="category/apex/design.xml/ExcessivePublicCount" message="This class has too many public methods and attributes">
|
|
22
|
+
<priority>3</priority>
|
|
23
|
+
<properties>
|
|
24
|
+
<property name="minimum" value="25" />
|
|
25
|
+
</properties>
|
|
26
|
+
</rule>
|
|
27
|
+
<rule ref="category/apex/design.xml/NcssConstructorCount" message="The constructor has an NCSS line count of {0}">
|
|
28
|
+
<priority>3</priority>
|
|
29
|
+
<properties>
|
|
30
|
+
<property name="minimum" value="20" />
|
|
31
|
+
</properties>
|
|
32
|
+
</rule>
|
|
33
|
+
<rule ref="category/apex/design.xml/NcssMethodCount" message="The method {0}() has an NCSS line count of {1}">
|
|
34
|
+
<priority>3</priority>
|
|
35
|
+
<properties>
|
|
36
|
+
<property name="minimum" value="60" />
|
|
37
|
+
</properties>
|
|
38
|
+
</rule>
|
|
39
|
+
<rule ref="category/apex/design.xml/NcssTypeCount" message="The type has an NCSS line count of {0}">
|
|
40
|
+
<priority>3</priority>
|
|
41
|
+
<properties>
|
|
42
|
+
<property name="minimum" value="700" />
|
|
43
|
+
</properties>
|
|
44
|
+
</rule>
|
|
45
|
+
<rule ref="category/apex/design.xml/StdCyclomaticComplexity" message="The {0} ''{1}'' has a Standard Cyclomatic Complexity of {2}.">
|
|
46
|
+
<priority>3</priority>
|
|
47
|
+
<properties>
|
|
48
|
+
<property name="reportLevel" value="10" />
|
|
49
|
+
</properties>
|
|
50
|
+
</rule>
|
|
51
|
+
<rule ref="category/apex/design.xml/TooManyFields" message="Too many fields">
|
|
52
|
+
<priority>3</priority>
|
|
53
|
+
<properties>
|
|
54
|
+
<property name="maxfields" value="20" />
|
|
55
|
+
</properties>
|
|
56
|
+
</rule>
|
|
57
|
+
<rule ref="category/apex/design.xml/AvoidDeeplyNestedIfStmts" message="Deeply nested if..else statements are hard to read">
|
|
58
|
+
<priority>3</priority>
|
|
59
|
+
<properties>
|
|
60
|
+
<property name="problemDepth" value="4" />
|
|
61
|
+
</properties>
|
|
62
|
+
</rule>
|
|
63
|
+
<rule ref="category/apex/design.xml/CyclomaticComplexity">
|
|
64
|
+
<priority>3</priority>
|
|
65
|
+
</rule>
|
|
66
|
+
<!-- <rule ref="category/apex/design.xml/CognitiveComplexity"/> -->
|
|
67
|
+
|
|
68
|
+
<!-- PERFORMANCE -->
|
|
69
|
+
<rule ref="category/apex/performance.xml/OperationWithLimitsInLoop" message="Avoid operations in loops that may hit governor limits">
|
|
70
|
+
<priority>3</priority>
|
|
71
|
+
</rule>
|
|
72
|
+
<!-- <rule ref="category/apex/performance.xml/OperationWithHighCostInLoop" message="Avoid operations in loops that can impact performances">
|
|
73
|
+
<priority>3</priority>
|
|
74
|
+
</rule> -->
|
|
75
|
+
<rule ref="category/apex/errorprone.xml/AvoidDirectAccessTriggerMap" message="Avoid directly accessing Trigger.old and Trigger.new">
|
|
76
|
+
<priority>3</priority>
|
|
77
|
+
</rule>
|
|
78
|
+
<rule ref="category/apex/bestpractices.xml/AvoidLogicInTrigger" message="Avoid logic in triggers">
|
|
79
|
+
<priority>3</priority>
|
|
80
|
+
</rule>
|
|
81
|
+
<rule ref="category/apex/bestpractices.xml/AvoidGlobalModifier" message="Avoid using global modifier">
|
|
82
|
+
<priority>3</priority>
|
|
83
|
+
</rule>
|
|
84
|
+
<rule ref="category/apex/errorprone.xml/AvoidNonExistentAnnotations">
|
|
85
|
+
</rule>
|
|
86
|
+
<rule ref="category/apex/errorprone.xml/AvoidHardcodingId" message="Avoid hardcoding ID's">
|
|
87
|
+
<priority>3</priority>
|
|
88
|
+
</rule>
|
|
89
|
+
<!-- <rule ref="category/apex/performance.xml/AvoidDebugStatements" /> -->
|
|
90
|
+
<!-- <rule ref="category/apex/performance.xml/EagerlyLoadedDescribeSObjectResult" /> -->
|
|
91
|
+
|
|
92
|
+
<!-- NAMING -->
|
|
93
|
+
<rule ref="category/apex/codestyle.xml/ClassNamingConventions" message="Class names should begin with an uppercase character">
|
|
94
|
+
<priority>3</priority>
|
|
95
|
+
</rule>
|
|
96
|
+
<rule ref="category/apex/codestyle.xml/MethodNamingConventions" message="Method name does not begin with a lower case character.">
|
|
97
|
+
<priority>3</priority>
|
|
98
|
+
</rule>
|
|
99
|
+
<rule ref="category/apex/errorprone.xml/MethodWithSameNameAsEnclosingClass" message="Classes should not have non-constructor methods with the same name as the class">
|
|
100
|
+
<priority>3</priority>
|
|
101
|
+
</rule>
|
|
102
|
+
|
|
103
|
+
<!-- NAMING -->
|
|
104
|
+
<rule ref="category/apex/codestyle.xml/FieldNamingConventions">
|
|
105
|
+
<priority>3</priority>
|
|
106
|
+
</rule>
|
|
107
|
+
<rule ref="category/apex/codestyle.xml/FormalParameterNamingConventions">
|
|
108
|
+
<priority>3</priority>
|
|
109
|
+
</rule>
|
|
110
|
+
<rule ref="category/apex/codestyle.xml/LocalVariableNamingConventions">
|
|
111
|
+
<priority>3</priority>
|
|
112
|
+
</rule>
|
|
113
|
+
<rule ref="category/apex/codestyle.xml/PropertyNamingConventions">
|
|
114
|
+
<priority>3</priority>
|
|
115
|
+
</rule>
|
|
116
|
+
|
|
117
|
+
<!-- TESTS -->
|
|
118
|
+
<rule ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveAsserts" message="Apex unit test classes should have at least one System.assert() or assertEquals() or AssertNotEquals() call">
|
|
119
|
+
<priority>3</priority>
|
|
120
|
+
</rule>
|
|
121
|
+
<rule ref="category/apex/bestpractices.xml/ApexUnitTestShouldNotUseSeeAllDataTrue" message="@isTest(seeAllData=true) should not be used in Apex unit tests because it opens up the existing database data for unexpected modification by tests">
|
|
122
|
+
<priority>3</priority>
|
|
123
|
+
</rule>
|
|
124
|
+
<rule ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveRunAs" />
|
|
125
|
+
<!-- <rule ref="category/apex/bestpractices.xml/ApexAssertionsShouldIncludeMessage"/> -->
|
|
126
|
+
<!-- <rule ref="category/apex/bestpractices.xml/ApexUnitTestMethodShouldHaveIsTestAnnotation"/> -->
|
|
127
|
+
<!-- <rule ref="category/apex/errorprone.xml/TestMethodsMustBeInTestClasses"/> -->
|
|
128
|
+
|
|
129
|
+
<!-- SECURITY -->
|
|
130
|
+
<rule ref="category/apex/security.xml/ApexSharingViolations" message="Apex classes should declare a sharing model if DML or SOQL is used">
|
|
131
|
+
<priority>3</priority>
|
|
132
|
+
</rule>
|
|
133
|
+
<rule ref="category/apex/security.xml/ApexInsecureEndpoint" message="Apex callouts should use encrypted communication channels">
|
|
134
|
+
<priority>3</priority>
|
|
135
|
+
</rule>
|
|
136
|
+
<rule ref="category/apex/errorprone.xml/ApexCSRF">
|
|
137
|
+
<priority>3</priority>
|
|
138
|
+
</rule>
|
|
139
|
+
<rule ref="category/apex/security.xml/ApexOpenRedirect" message="Apex classes should safely redirect to a known location">
|
|
140
|
+
<priority>3</priority>
|
|
141
|
+
</rule>
|
|
142
|
+
<rule ref="category/apex/security.xml/ApexSOQLInjection" message="Apex classes should escape variables merged in DML query">
|
|
143
|
+
<priority>3</priority>
|
|
144
|
+
</rule>
|
|
145
|
+
<rule ref="category/apex/security.xml/ApexXSSFromURLParam" message="Apex classes should escape Strings obtained from URL parameters">
|
|
146
|
+
<priority>3</priority>
|
|
147
|
+
</rule>
|
|
148
|
+
<rule ref="category/apex/security.xml/ApexXSSFromEscapeFalse" message="Apex classes should escape addError strings">
|
|
149
|
+
<priority>3</priority>
|
|
150
|
+
</rule>
|
|
151
|
+
<rule ref="category/apex/security.xml/ApexBadCrypto" message="Apex Crypto should use random IV/key">
|
|
152
|
+
<priority>3</priority>
|
|
153
|
+
</rule>
|
|
154
|
+
<rule ref="category/apex/security.xml/ApexCRUDViolation" message="Validate CRUD permission before SOQL/DML operation">
|
|
155
|
+
<priority>3</priority>
|
|
156
|
+
</rule>
|
|
157
|
+
<rule ref="category/apex/security.xml/ApexDangerousMethods" message="Calling potentially dangerous method">
|
|
158
|
+
<priority>3</priority>
|
|
159
|
+
</rule>
|
|
160
|
+
<rule ref="category/apex/security.xml/ApexSuggestUsingNamedCred" message="Consider using named credentials for authenticated callouts">
|
|
161
|
+
<priority>3</priority>
|
|
162
|
+
</rule>
|
|
163
|
+
|
|
164
|
+
<!-- BRACES -->
|
|
165
|
+
<rule ref="category/apex/codestyle.xml/IfStmtsMustUseBraces" message="Avoid using if statements without curly braces">
|
|
166
|
+
<priority>3</priority>
|
|
167
|
+
</rule>
|
|
168
|
+
<rule ref="category/apex/codestyle.xml/WhileLoopsMustUseBraces" message="Avoid using 'while' statements without curly braces">
|
|
169
|
+
<priority>3</priority>
|
|
170
|
+
</rule>
|
|
171
|
+
<rule ref="category/apex/codestyle.xml/IfElseStmtsMustUseBraces" message="Avoid using 'if...else' statements without curly braces">
|
|
172
|
+
<priority>3</priority>
|
|
173
|
+
</rule>
|
|
174
|
+
<rule ref="category/apex/codestyle.xml/ForLoopsMustUseBraces" message="Avoid using 'for' statements without curly braces">
|
|
175
|
+
<priority>3</priority>
|
|
176
|
+
</rule>
|
|
177
|
+
|
|
178
|
+
<!-- EMPTY -->
|
|
179
|
+
<rule ref="category/apex/errorprone.xml/EmptyCatchBlock" message="Avoid empty catch blocks">
|
|
180
|
+
<priority>3</priority>
|
|
181
|
+
</rule>
|
|
182
|
+
<rule ref="category/apex/errorprone.xml/EmptyIfStmt" message="Avoid empty 'if' statements">
|
|
183
|
+
<priority>3</priority>
|
|
184
|
+
</rule>
|
|
185
|
+
<rule ref="category/apex/errorprone.xml/EmptyWhileStmt" message="Avoid empty 'while' statements">
|
|
186
|
+
<priority>3</priority>
|
|
187
|
+
</rule>
|
|
188
|
+
<rule ref="category/apex/errorprone.xml/EmptyTryOrFinallyBlock" message="Avoid empty try or finally blocks">
|
|
189
|
+
<priority>3</priority>
|
|
190
|
+
</rule>
|
|
191
|
+
<rule ref="category/apex/errorprone.xml/EmptyStatementBlock" message="Avoid empty block statements.">
|
|
192
|
+
<priority>3</priority>
|
|
193
|
+
</rule>
|
|
194
|
+
|
|
195
|
+
<!-- STYLE -->
|
|
196
|
+
<rule ref="category/apex/codestyle.xml/OneDeclarationPerLine">
|
|
197
|
+
<priority>3</priority>
|
|
198
|
+
</rule>
|
|
199
|
+
<!-- <rule ref="category/apex/codestyle.xml/FieldDeclarationsShouldBeAtStart"/> -->
|
|
200
|
+
|
|
201
|
+
<!-- DOCUMENTATION -->
|
|
202
|
+
<rule ref="category/apex/documentation.xml/ApexDoc" message="Document classes, methods, and properties that are public or global.">
|
|
203
|
+
<priority>3</priority>
|
|
204
|
+
</rule>
|
|
205
|
+
|
|
206
|
+
<!-- CLARITY / BEST PRACTICES -->
|
|
207
|
+
<rule ref="category/apex/bestpractices.xml/DebugsShouldUseLoggingLevel">
|
|
208
|
+
<priority>3</priority>
|
|
209
|
+
</rule>
|
|
210
|
+
<!-- <rule ref="category/apex/bestpractices.xml/UnusedLocalVariable"/> -->
|
|
211
|
+
<!-- <rule ref="category/apex/errorprone.xml/OverrideBothEqualsAndHashcode" /> -->
|
|
212
|
+
<!-- <rule ref="category/apex/errorprone.xml/InaccessibleAuraEnabledGetter" /> -->
|
|
213
|
+
|
|
214
|
+
</ruleset>
|