@terafina/tffa-sfdx-plugin 14.0.1 → 15.0.0-rc.3
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 +6 -6
- package/bin/pmd/apex_vf_ruleset.xml +17 -0
- package/bin/pmd/lib/pmd-visualforce-6.47.0.jar +0 -0
- package/bin/update.sh +0 -1
- package/lib/commands/tffa/lint.js +3 -2
- package/lib/commands/tffa/lint.js.map +1 -1
- package/lib/services/lint/apex-class-scan.d.ts +1 -3
- package/lib/services/lint/apex-class-scan.js +16 -109
- package/lib/services/lint/apex-class-scan.js.map +1 -1
- package/lib/services/lint/apex-pmd.d.ts +1 -0
- package/lib/services/lint/apex-pmd.js +9 -3
- package/lib/services/lint/apex-pmd.js.map +1 -1
- package/lib/services/lint/metadata-scan.d.ts +10 -4
- package/lib/services/lint/metadata-scan.js +44 -65
- package/lib/services/lint/metadata-scan.js.map +1 -1
- package/lib/services/lint/rules.d.ts +10 -0
- package/lib/services/lint/rules.js +86 -0
- package/lib/services/lint/rules.js.map +1 -0
- package/lib/utils/ignored-files.d.ts +2 -0
- package/lib/utils/ignored-files.js +66 -1
- package/lib/utils/ignored-files.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ $ npm install -g @terafina/tffa-sfdx-plugin
|
|
|
41
41
|
$ sfdx COMMAND
|
|
42
42
|
running command...
|
|
43
43
|
$ sfdx (--version|-v)
|
|
44
|
-
@terafina/tffa-sfdx-plugin/
|
|
44
|
+
@terafina/tffa-sfdx-plugin/15.0.0-rc.3 linux-x64 node-v16.13.1
|
|
45
45
|
$ sfdx --help [COMMAND]
|
|
46
46
|
USAGE
|
|
47
47
|
$ sfdx COMMAND
|
|
@@ -103,7 +103,7 @@ EXAMPLES
|
|
|
103
103
|
Generate Apex API Documentation : $sfdx tffa:apexdoc
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
_See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/
|
|
106
|
+
_See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.3/src/commands/tffa/apexdoc.ts)_
|
|
107
107
|
|
|
108
108
|
## `sfdx tffa:lint [-s <directory>] [-m <integer>] [-r <filepath>] [-e] [-f] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
109
109
|
|
|
@@ -130,10 +130,10 @@ DESCRIPTION
|
|
|
130
130
|
scan a sfdx project and provide a violations report based on defined standards
|
|
131
131
|
|
|
132
132
|
EXAMPLES
|
|
133
|
-
|
|
133
|
+
$sfdx tffa:lint
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
_See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/
|
|
136
|
+
_See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.3/src/commands/tffa/lint.ts)_
|
|
137
137
|
|
|
138
138
|
## `sfdx tffa:meta [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
139
139
|
|
|
@@ -162,7 +162,7 @@ EXAMPLES
|
|
|
162
162
|
scan a sfdx project for metadata : $sfdx tffa:meta
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
_See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/
|
|
165
|
+
_See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.3/src/commands/tffa/meta.ts)_
|
|
166
166
|
|
|
167
167
|
## `sfdx tffa:ping [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
168
168
|
|
|
@@ -184,7 +184,7 @@ EXAMPLES
|
|
|
184
184
|
$ sfdx tffa:ping
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
_See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/
|
|
187
|
+
_See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.3/src/commands/tffa/ping.ts)_
|
|
188
188
|
|
|
189
189
|
## `sfdx version`
|
|
190
190
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<ruleset
|
|
3
|
+
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
|
4
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
5
|
+
name="TFFA ruleset for Salesforce.com Visualforce pages"
|
|
6
|
+
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"
|
|
7
|
+
>
|
|
8
|
+
<description>TFFA ruleset for Salesforce.com Visualforce pages</description>
|
|
9
|
+
<exclude-pattern>.*</exclude-pattern>
|
|
10
|
+
<include-pattern>.*/app/main/default/pages/.*</include-pattern>
|
|
11
|
+
<!-- SECURITY -->
|
|
12
|
+
<rule ref="category/vf/security.xml">
|
|
13
|
+
<exclude name="VfCsrf" />
|
|
14
|
+
</rule>
|
|
15
|
+
<!-- SECURITY -->
|
|
16
|
+
|
|
17
|
+
</ruleset>
|
|
Binary file
|
package/bin/update.sh
CHANGED
|
@@ -24,7 +24,8 @@ class Lint extends command_1.SfdxCommand {
|
|
|
24
24
|
let violations = [];
|
|
25
25
|
await ignored_files_1.default.init(this.flags.sourcefolder);
|
|
26
26
|
violations = await new apex_class_scan_1.default().scan(this.flags.sourcefolder);
|
|
27
|
-
let mViolations =
|
|
27
|
+
let mViolations = [];
|
|
28
|
+
mViolations = await new metadata_scan_1.default(namespace).scan(this.flags.sourcefolder, this.flags.minapi);
|
|
28
29
|
violations.push(...mViolations);
|
|
29
30
|
mViolations = await new apex_pmd_1.default().scan(this.flags.sourcefolder, this.flags.rulesetpath);
|
|
30
31
|
violations.push(...mViolations);
|
|
@@ -51,7 +52,7 @@ class Lint extends command_1.SfdxCommand {
|
|
|
51
52
|
}
|
|
52
53
|
exports.default = Lint;
|
|
53
54
|
Lint.description = 'scan a sfdx project and provide a violations report based on defined standards';
|
|
54
|
-
Lint.examples = [
|
|
55
|
+
Lint.examples = [`$sfdx tffa:lint`];
|
|
55
56
|
Lint.flagsConfig = {
|
|
56
57
|
sourcefolder: command_1.flags.directory({
|
|
57
58
|
char: 's',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../src/commands/tffa/lint.ts"],"names":[],"mappings":";AAAA;;IAEI;;;AAEJ,iDAAyD;AACzD,2CAA+C;AAC/C,kGAAgE;AAChE,sFAAqD;AACrD,8FAA6D;AAC7D,oFAAmD;AAEnD,MAAqB,IAAK,SAAQ,qBAAW;IAiC3C,8DAA8D;IACvD,KAAK,CAAC,GAAG;QACd,MAAM,OAAO,GAAG,MAAM,kBAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC;QACzD,MAAM,SAAS,GAAG,WAAW,CAAC,SAAmB,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,GAAG,CAAC,CAAC;QAEnD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,MAAM,IAAI,kBAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACnD,OAAO;SACR;QAED,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,MAAM,uBAAY,CAAC,IAAI,CAAC,IAAI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AM,EAAE,eAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,OAAO,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,sBAAsB;KACpC,CAAC;IACF,WAAW,EAAE,eAAK,CAAC,QAAQ,CAAC;QAC1B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,qBAAqB;KACnC,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,0BAA0B;KACxC,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4BAA4B;KAC1C,CAAC;CACH,CAAC"}
|
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
import { Logger } from '@salesforce/core';
|
|
5
5
|
export default class ApexClassScan {
|
|
6
6
|
dir: string;
|
|
7
|
-
allowedListEnd: string[];
|
|
8
|
-
allowedISVTEViolations: string[];
|
|
9
7
|
classFiles: any[];
|
|
10
8
|
violations: any[];
|
|
11
|
-
allowedListStart: string[];
|
|
12
9
|
ignoreFiles: any[];
|
|
13
10
|
logger: Logger;
|
|
14
11
|
scan(sourceFolder: string): Promise<unknown[]>;
|
|
@@ -18,6 +15,7 @@ export default class ApexClassScan {
|
|
|
18
15
|
* test file names as per conventions
|
|
19
16
|
*/
|
|
20
17
|
private checkFileNameConvention;
|
|
18
|
+
private checkClassesForKeywords2;
|
|
21
19
|
/**
|
|
22
20
|
* test class files for filter
|
|
23
21
|
* @param {*} keywords
|
|
@@ -8,75 +8,12 @@ const core_1 = require("@salesforce/core");
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
10
|
const ignored_files_1 = tslib_1.__importDefault(require("../../utils/ignored-files"));
|
|
11
|
+
const rules_1 = require("./rules");
|
|
11
12
|
class ApexClassScan {
|
|
12
13
|
constructor() {
|
|
13
14
|
this.dir = '';
|
|
14
|
-
this.allowedListEnd = [
|
|
15
|
-
'Repository',
|
|
16
|
-
'DTO',
|
|
17
|
-
'Request',
|
|
18
|
-
'Response',
|
|
19
|
-
'Result',
|
|
20
|
-
'Provider',
|
|
21
|
-
'Service',
|
|
22
|
-
'Controller',
|
|
23
|
-
'Constants',
|
|
24
|
-
'Job',
|
|
25
|
-
'Executor',
|
|
26
|
-
'Processor',
|
|
27
|
-
'Ext',
|
|
28
|
-
'Utlity',
|
|
29
|
-
'Utils',
|
|
30
|
-
'Util',
|
|
31
|
-
'Resolver',
|
|
32
|
-
'Factory',
|
|
33
|
-
'EventExtension',
|
|
34
|
-
'EventFactory',
|
|
35
|
-
'Exception',
|
|
36
|
-
'Calculator',
|
|
37
|
-
'Builder',
|
|
38
|
-
'Type',
|
|
39
|
-
'Logger',
|
|
40
|
-
'Context',
|
|
41
|
-
'Exporter',
|
|
42
|
-
'Status',
|
|
43
|
-
'Handler',
|
|
44
|
-
'Client',
|
|
45
|
-
'Serializer',
|
|
46
|
-
'Parser',
|
|
47
|
-
'Adapter',
|
|
48
|
-
'Configuration',
|
|
49
|
-
'Configurations',
|
|
50
|
-
'Mapper',
|
|
51
|
-
'Helper',
|
|
52
|
-
'Extension',
|
|
53
|
-
'Dom',
|
|
54
|
-
'Render',
|
|
55
|
-
'Record',
|
|
56
|
-
'Records',
|
|
57
|
-
'Generator',
|
|
58
|
-
'Formatter',
|
|
59
|
-
'Notifier',
|
|
60
|
-
'Enricher',
|
|
61
|
-
'Signer',
|
|
62
|
-
'Batch',
|
|
63
|
-
'Assigner',
|
|
64
|
-
'Dispatcher',
|
|
65
|
-
'Namespace',
|
|
66
|
-
'Interaction',
|
|
67
|
-
'Cipher',
|
|
68
|
-
'APICall',
|
|
69
|
-
'Cache',
|
|
70
|
-
'Validator',
|
|
71
|
-
'Evaluator',
|
|
72
|
-
'Matcher',
|
|
73
|
-
'Credential',
|
|
74
|
-
'Comparator'
|
|
75
|
-
];
|
|
76
|
-
this.allowedISVTEViolations = ['Translations', 'SECURITY_ENFORCED', 'Multiple Change Processes per Object'];
|
|
77
15
|
this.classFiles = [];
|
|
78
16
|
this.violations = [];
|
|
79
|
-
this.allowedListStart = ['Migration', 'SObject'];
|
|
80
17
|
this.ignoreFiles = [];
|
|
81
18
|
}
|
|
82
19
|
async scan(sourceFolder) {
|
|
@@ -93,23 +30,9 @@ class ApexClassScan {
|
|
|
93
30
|
this.logger.debug(this.ignoreFiles);
|
|
94
31
|
await Promise.all([
|
|
95
32
|
this.checkFileNameConvention(),
|
|
96
|
-
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
99
|
-
this.checkClassesForKeywords('\\.isUpdateable', 'CRUD/FLS Checks are checked by tffa.AbstractRepository', 'INTERNAL', 'FATAL'),
|
|
100
|
-
this.checkClassesForKeywords('tffa\\.AbstractRepository\\.', 'Do not call methods directly of an abstract class . Call methods from Repository classes extending tffa.AbstractRepository', 'INTERNAL', 'FATAL'),
|
|
101
|
-
this.checkClassesForKeywords('tffa\\.AbstractController\\.', 'Do not call methods directly of an abstract class . Call methods from Controllers classes extending tffa.AbstractController', 'INTERNAL', 'FATAL'),
|
|
102
|
-
this.checkClassesForKeywords('tffa\\.AbstractRESTService\\.', 'Do not call methods directly of an abstract class . Call methods from RESTService classes extending tffa.AbstractRESTService', 'INTERNAL', 'FATAL'),
|
|
103
|
-
this.checkClassesForKeywords('select ', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method ', 'INTERNAL', 'FATAL'),
|
|
104
|
-
this.checkClassesForKeywords('update ', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doUpdate method ', 'INTERNAL', 'FATAL'),
|
|
105
|
-
this.checkClassesForKeywords('upsert ', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doUpsert method ', 'INTERNAL', 'FATAL'),
|
|
106
|
-
this.checkClassesForKeywords('delete ', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doDelete method ', 'INTERNAL', 'FATAL'),
|
|
107
|
-
this.checkClassesForKeywords('Database\\.query', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method ', 'INTERNAL', 'FATAL'),
|
|
108
|
-
this.checkClassesForKeywords('Database\\.update', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method ', 'INTERNAL', 'FATAL'),
|
|
109
|
-
this.checkClassesForKeywords('Database\\.insert', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method ', 'INTERNAL', 'FATAL'),
|
|
110
|
-
this.checkClassesForKeywords('Database\\.upsert', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method ', 'INTERNAL', 'FATAL'),
|
|
111
|
-
this.checkClassesForKeywords('Database\\.delete', 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method ', 'INTERNAL', 'FATAL'),
|
|
112
|
-
this.checkClassesForKeywords('SuppressWarnings', 'Do not supress PMD warnings , instead fix them ', 'PMD', 'WARN')
|
|
33
|
+
this.checkClassesForKeywords2('(tffa\\.AbstractRepository\\.|tffa\\.AbstractController\\.|tffa\\.AbstractRESTService\\.)', 'DIRECT_ABSTRACT_CLASS'),
|
|
34
|
+
this.checkClassesForKeywords2('(\\[select |\\[update |\\[upsert |\\[delete |\\bDatabase\\.query\\b|\\bDatabase\\.update\\b|\\bDatabase\\.insert\\b|\\bDatabase\\.upsert\\b|\\bDatabase\\.delete\\b)', 'SOQL_REPOSITORY'),
|
|
35
|
+
this.checkClassesForKeywords2('SuppressWarnings', 'NO_SUPPRESSWARNINGS')
|
|
113
36
|
]);
|
|
114
37
|
return this.violations;
|
|
115
38
|
}
|
|
@@ -120,11 +43,8 @@ class ApexClassScan {
|
|
|
120
43
|
this.ignoreFiles.push(...ignored_files_1.default.files);
|
|
121
44
|
this.logger.debug(this.ignoreFiles);
|
|
122
45
|
await Promise.all([
|
|
123
|
-
this.
|
|
124
|
-
this.
|
|
125
|
-
this.checkClassesForKeywords('System\\.assertNotEquals\\(true\\, false\\)', 'Apex unit tests should include at least one assertion . Do not hard code values. Use proper variables', 'PMD', 'FATAL', 'System\\.assertNotEquals\\(true\\, false\\)\\;'),
|
|
126
|
-
this.checkClassesForKeywords('System\\.assertNotEquals\\(false\\, true\\)', 'Apex unit tests should include at least one assertion . Do not hard code values. Use proper variables', 'PMD', 'FATAL', 'System\\.assertNotEquals\\(false\\, true\\)\\;'),
|
|
127
|
-
this.checkClassesForKeywords('System\\.assert\\(true\\)', 'Apex unit tests should include at least one assertion . Do not hard code values. Use proper variables', 'PMD', 'FATAL', 'System\\.assert\\(true\\)\\;')
|
|
46
|
+
this.checkClassesForKeywords2('SuppressWarnings', 'NO_SUPPRESSWARNINGS'),
|
|
47
|
+
this.checkClassesForKeywords2('(System\\.assertEquals\\(true\\, true\\)|System\\.assertNotEquals\\(true\\, false\\)|System\\.assertNotEquals\\(false\\, true\\)|System\\.assert\\(true\\))', 'NO_SYSTEM_ASSERT_HARDCODING')
|
|
128
48
|
]);
|
|
129
49
|
return this.violations;
|
|
130
50
|
}
|
|
@@ -138,8 +58,8 @@ class ApexClassScan {
|
|
|
138
58
|
const filepath = path_1.default.join(this.dir, file);
|
|
139
59
|
if (path_1.default.extname(filepath) == '.cls') {
|
|
140
60
|
const filename = path_1.default.basename(filepath, '.cls');
|
|
141
|
-
if (!
|
|
142
|
-
!
|
|
61
|
+
if (!ignored_files_1.default.allowedClassNameListEnd.some(substring => filename.endsWith(substring)) &&
|
|
62
|
+
!ignored_files_1.default.allowedClassNameListStart.some(substring => filename.startsWith(substring))) {
|
|
143
63
|
if (this.ignoreFiles.indexOf(filename) < 0 && this.ignoreFiles.indexOf(file) < 0) {
|
|
144
64
|
violatingFiles.push(filename);
|
|
145
65
|
}
|
|
@@ -151,35 +71,26 @@ class ApexClassScan {
|
|
|
151
71
|
}
|
|
152
72
|
}
|
|
153
73
|
if (violatingFiles.length > 0) {
|
|
154
|
-
const o = {
|
|
155
|
-
label: 'Files violating naming conventions',
|
|
156
|
-
message: 'Classes should' + '\nend with [' + this.allowedListEnd.join(', ') + ']',
|
|
157
|
-
exceptions: violatingFiles,
|
|
158
|
-
category: 'INTERNAL',
|
|
159
|
-
level: 'FATAL'
|
|
160
|
-
};
|
|
74
|
+
const o = { ...rules_1.Rules.customrules['APEX_NAME_CONVENTION'], exceptions: violatingFiles };
|
|
161
75
|
this.violations.push(o);
|
|
162
76
|
}
|
|
163
77
|
resolve(null);
|
|
164
78
|
});
|
|
165
79
|
}
|
|
80
|
+
checkClassesForKeywords2(keywords, errorkey) {
|
|
81
|
+
const o = rules_1.Rules.customrules[errorkey];
|
|
82
|
+
this.checkClassesForKeywords(keywords, o.label, o.message, o.category, o.level);
|
|
83
|
+
}
|
|
166
84
|
/**
|
|
167
85
|
* test class files for filter
|
|
168
86
|
* @param {*} keywords
|
|
169
87
|
* @param {*} hint
|
|
170
88
|
*/
|
|
171
|
-
checkClassesForKeywords(keywords, hint, category, level
|
|
89
|
+
checkClassesForKeywords(keywords, label, hint, category, level) {
|
|
172
90
|
return new Promise(resolve => {
|
|
173
91
|
const violatingFiles = [];
|
|
174
92
|
// We want full words, so we use full word boundary in regex.
|
|
175
|
-
|
|
176
|
-
if (regexInput) {
|
|
177
|
-
regex = new RegExp(regexInput);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
regex = new RegExp("^(?!\\s*(\\'|\\//|\\*)\\s*).*(\\b" + keywords + '\\b).*$', 'gim');
|
|
181
|
-
}
|
|
182
|
-
// this.logger.debug(regex);
|
|
93
|
+
const regex = new RegExp("^(?!\\s*(\\'|\\//|\\*)\\s*).*(" + keywords + ').*$', 'gim');
|
|
183
94
|
this.classFiles.forEach(file => {
|
|
184
95
|
const fileContent = (0, fs_1.readFileSync)(file);
|
|
185
96
|
const filec = fileContent.toString();
|
|
@@ -189,10 +100,6 @@ class ApexClassScan {
|
|
|
189
100
|
const output = filec.match(regex);
|
|
190
101
|
for (let i = 0; i < output.length; ++i) {
|
|
191
102
|
if (output[i].indexOf("'") < 0 || output[i].toLowerCase().indexOf(keywords.toLowerCase()) < output[i].indexOf("'")) {
|
|
192
|
-
// this.logger.debug(path.basename(file, '.cls'));
|
|
193
|
-
// this.logger.debug(output[i]);
|
|
194
|
-
// this.logger.debug(output[i].indexOf(keywords));
|
|
195
|
-
// this.logger.debug(filec.indexOf("'"));
|
|
196
103
|
found = true;
|
|
197
104
|
break;
|
|
198
105
|
}
|
|
@@ -210,7 +117,7 @@ class ApexClassScan {
|
|
|
210
117
|
});
|
|
211
118
|
if (violatingFiles.length > 0) {
|
|
212
119
|
const o = {
|
|
213
|
-
label:
|
|
120
|
+
label: label,
|
|
214
121
|
message: hint,
|
|
215
122
|
exceptions: violatingFiles,
|
|
216
123
|
category: category,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apex-class-scan.js","sourceRoot":"","sources":["../../../src/services/lint/apex-class-scan.ts"],"names":[],"mappings":";AAAA;;IAEI;;;AAEJ,2CAA0C;AAC1C,2BAAsE;AACtE,wDAAwB;AACxB,sFAAqD;
|
|
1
|
+
{"version":3,"file":"apex-class-scan.js","sourceRoot":"","sources":["../../../src/services/lint/apex-class-scan.ts"],"names":[],"mappings":";AAAA;;IAEI;;;AAEJ,2CAA0C;AAC1C,2BAAsE;AACtE,wDAAwB;AACxB,sFAAqD;AACrD,mCAAgC;AAEhC,MAAqB,aAAa;IAAlC;QACE,QAAG,GAAG,EAAE,CAAC;QACT,eAAU,GAAG,EAAE,CAAC;QAChB,eAAU,GAAG,EAAE,CAAC;QAChB,gBAAW,GAAG,EAAE,CAAC;IA+JnB,CAAC;IA5JQ,KAAK,CAAC,IAAI,CAAC,YAAoB;QACpC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;Q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ACL,CAAC;IAED;;;;OAIG;IACK,mBAAmB,CAAC,GAAG,EAAE,GAAG;QAClC,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,IAAA,eAAU,EAAC,GAAG,CAAC,EAAE;YACpB,MAAM,KAAK,CAAC,wBAAwB,GAAG,iBAAiB,CAAC,CAAC;SAC3D;QAED,IAAA,gBAAW,EAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC9B,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACtC,MAAM,IAAI,GAAG,IAAA,cAAS,EAAC,QAAQ,CAAC,CAAC;YAEjC,yGAAyG;YACzG,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;gBACtB,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;gBAC5D,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;aACnC;iBAAM;gBACL,IAAI,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE;oBAC9B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACtB;aACF;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAnKD,gCAmKC"}
|
|
@@ -2,6 +2,7 @@ import { Logger } from '@salesforce/core';
|
|
|
2
2
|
export default class ApexPMD {
|
|
3
3
|
ignoreFiles: any[];
|
|
4
4
|
logger: Logger;
|
|
5
|
+
rules: string[];
|
|
5
6
|
eject(sourceFolder: string): Promise<unknown[]>;
|
|
6
7
|
scan(sourceFolder: string, rulesetpath: string): Promise<any[]>;
|
|
7
8
|
private executeCmd;
|
|
@@ -16,11 +16,13 @@ const CLASSPATH_DELM = os.platform() === 'win32' ? ';' : ':';
|
|
|
16
16
|
class ApexPMD {
|
|
17
17
|
constructor() {
|
|
18
18
|
this.ignoreFiles = [];
|
|
19
|
+
this.rules = ['apex_ruleset.xml', 'apex_test_ruleset.xml', 'apex_vf_ruleset.xml'];
|
|
19
20
|
}
|
|
20
21
|
async eject(sourceFolder) {
|
|
21
22
|
const pmdBinPath = path.join(__dirname, '../../../', 'bin', 'pmd');
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
for (const rulefile of this.rules) {
|
|
24
|
+
fs_1.default.copyFileSync(path.resolve(pmdBinPath, rulefile), path.resolve(sourceFolder, 'scripts', 'pmd', rulefile));
|
|
25
|
+
}
|
|
24
26
|
return;
|
|
25
27
|
}
|
|
26
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -47,7 +49,11 @@ class ApexPMD {
|
|
|
47
49
|
const javaExc = path.join(javaHome, 'bin', 'java');
|
|
48
50
|
const commandBufferSize = 64;
|
|
49
51
|
const pmdBinPath = path.join(__dirname, '../../../', 'bin', 'pmd');
|
|
50
|
-
|
|
52
|
+
const rulepaths = [];
|
|
53
|
+
for (const rulefile of this.rules) {
|
|
54
|
+
rulepaths.push(path.join(pmdBinPath, rulefile));
|
|
55
|
+
}
|
|
56
|
+
let rulesetsArg = rulepaths.join(',');
|
|
51
57
|
if (rulesetpath) {
|
|
52
58
|
rulesetsArg = rulesetpath;
|
|
53
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apex-pmd.js","sourceRoot":"","sources":["../../../src/services/lint/apex-pmd.ts"],"names":[],"mappings":";;;AAAA;;IAEI;AACJ,oEAA8C;AAC9C,mDAA6B;AAC7B,+CAAyB;AACzB,2CAA0C;AAC1C,qFAA+D;AAC/D,sFAAqD;AACrD,oDAAoB;AAEpB,oBAAoB;AACpB,MAAM,cAAc,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAE7D,MAAqB,OAAO;IAA5B;QACE,gBAAW,GAAG,EAAE,CAAC;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AAC,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;gBACrC,IAAI,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,CAAC,CAAC,EAAE;oBACN,CAAC,GAAG;wBACF,KAAK,EAAE,CAAC,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,eAAe,GAAG,GAAG;wBAChE,OAAO,EAAE,CAAC,CAAC,WAAW;wBACtB,QAAQ,EAAE,KAAK;wBACf,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;wBACxC,UAAU,EAAE,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC;qBAC3C,CAAC;iBACH;qBAAM;oBACL,CAAC,CAAC,UAAU,GAAG,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;iBAChE;gBACD,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;aAC1B;SACF;QACD,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QAE/C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAhID,0BAgIC"}
|
|
@@ -8,17 +8,23 @@ export default class MetadataScan {
|
|
|
8
8
|
ignoreFiles: any[];
|
|
9
9
|
violations: unknown[];
|
|
10
10
|
logger: Logger;
|
|
11
|
+
apiViolations: any[];
|
|
11
12
|
scan(sourceFolder: string, minapi: number): Promise<unknown[]>;
|
|
12
|
-
/**
|
|
13
|
-
* scan json files
|
|
14
|
-
*/
|
|
15
|
-
private scanJSONFiles;
|
|
16
13
|
/**
|
|
17
14
|
* parse objects
|
|
18
15
|
* @param {*} objpath
|
|
19
16
|
* @param {*} clientname
|
|
20
17
|
*/
|
|
21
18
|
private scanObjects;
|
|
19
|
+
/**
|
|
20
|
+
* scan api
|
|
21
|
+
* @param sourceFolder
|
|
22
|
+
* @param minapi
|
|
23
|
+
*/
|
|
22
24
|
private scanAPIVersion;
|
|
23
25
|
private scanAPIVersionByType;
|
|
26
|
+
/**
|
|
27
|
+
* scan json files
|
|
28
|
+
*/
|
|
29
|
+
private scanJSONFiles;
|
|
24
30
|
}
|
|
@@ -9,11 +9,13 @@ const fs_1 = require("fs");
|
|
|
9
9
|
const path = require("path");
|
|
10
10
|
const xml2js = require("xml2js");
|
|
11
11
|
const ignored_files_1 = tslib_1.__importDefault(require("../../utils/ignored-files"));
|
|
12
|
+
const rules_1 = require("./rules");
|
|
12
13
|
class MetadataScan {
|
|
13
14
|
constructor(namespace) {
|
|
14
15
|
this.namespace = undefined;
|
|
15
16
|
this.ignoreFiles = [];
|
|
16
17
|
this.violations = [];
|
|
18
|
+
this.apiViolations = [];
|
|
17
19
|
this.namespace = namespace;
|
|
18
20
|
}
|
|
19
21
|
async scan(sourceFolder, minapi) {
|
|
@@ -24,24 +26,6 @@ class MetadataScan {
|
|
|
24
26
|
await this.scanAPIVersion(sourceFolder, minapi);
|
|
25
27
|
return this.violations;
|
|
26
28
|
}
|
|
27
|
-
/**
|
|
28
|
-
* scan json files
|
|
29
|
-
*/
|
|
30
|
-
async scanJSONFiles(path, minapi) {
|
|
31
|
-
const fileContent = (0, fs_1.readFileSync)(path + '/sfdx-project.json');
|
|
32
|
-
const obj = JSON.parse(fileContent.toString());
|
|
33
|
-
if (minapi > parseInt(obj['sourceApiVersion'])) {
|
|
34
|
-
// this.logger.debug(obj["sourceApiVersion"]);
|
|
35
|
-
const o = {
|
|
36
|
-
label: 'Project source api version not equal to ' + minapi,
|
|
37
|
-
message: 'Please update sourceApiVersion to ' + minapi + ' sfdx-project.json',
|
|
38
|
-
category: 'API',
|
|
39
|
-
level: 'FATAL',
|
|
40
|
-
exceptions: ['sfdx-project.json']
|
|
41
|
-
};
|
|
42
|
-
this.violations.push(o);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
29
|
/**
|
|
46
30
|
* parse objects
|
|
47
31
|
* @param {*} objpath
|
|
@@ -120,10 +104,20 @@ class MetadataScan {
|
|
|
120
104
|
}
|
|
121
105
|
}
|
|
122
106
|
if (found) {
|
|
123
|
-
|
|
107
|
+
if (!(ignored_files_1.default.skipObjects.includes(tabname) ||
|
|
108
|
+
ignored_files_1.default.skipStandardObjects.includes(tabname) ||
|
|
109
|
+
tabname.match(ignored_files_1.default.skipObjectPrefixes) ||
|
|
110
|
+
tabname.match(ignored_files_1.default.integrationPrefixes))) {
|
|
111
|
+
fieldUnderScoreViolations.push(tabname + '.' + fieldname);
|
|
112
|
+
}
|
|
124
113
|
}
|
|
125
114
|
if (tabname.startsWith('tffa__') && !fieldname.startsWith('CZ') && !fieldname.startsWith('cz')) {
|
|
126
|
-
|
|
115
|
+
if (!(ignored_files_1.default.skipObjects.includes(tabname) ||
|
|
116
|
+
ignored_files_1.default.skipStandardObjects.includes(tabname) ||
|
|
117
|
+
tabname.match(ignored_files_1.default.skipObjectPrefixes) ||
|
|
118
|
+
tabname.match(ignored_files_1.default.integrationPrefixes))) {
|
|
119
|
+
fieldCZNameViolations.push(tabname + '.' + fieldname);
|
|
120
|
+
}
|
|
127
121
|
}
|
|
128
122
|
const xml = (0, fs_1.readFileSync)(fieldFile);
|
|
129
123
|
try {
|
|
@@ -146,66 +140,46 @@ class MetadataScan {
|
|
|
146
140
|
}
|
|
147
141
|
}
|
|
148
142
|
if (tabViolations.length > 0) {
|
|
149
|
-
const o = {
|
|
150
|
-
label: 'Custom Objects should have a description',
|
|
151
|
-
message: `It is a best practice that Custom Objects have a description.`,
|
|
152
|
-
exceptions: tabViolations,
|
|
153
|
-
category: 'INTERNAL',
|
|
154
|
-
level: 'FATAL'
|
|
155
|
-
};
|
|
143
|
+
const o = { ...rules_1.Rules.customrules['CUSTOM_TAB_DESCRIPTION'], exceptions: tabViolations };
|
|
156
144
|
this.violations.push(o);
|
|
157
145
|
}
|
|
158
146
|
if (fieldViolations.length > 0) {
|
|
159
|
-
const o = {
|
|
160
|
-
label: 'Custom Fields should have a description',
|
|
161
|
-
message: `It is a best practice that Custom Fields have a description.`,
|
|
162
|
-
exceptions: fieldViolations,
|
|
163
|
-
category: 'INTERNAL',
|
|
164
|
-
level: 'FATAL'
|
|
165
|
-
};
|
|
147
|
+
const o = { ...rules_1.Rules.customrules['CUSTOM_FIELD_DESCRIPTION'], exceptions: fieldViolations };
|
|
166
148
|
this.violations.push(o);
|
|
167
149
|
}
|
|
168
150
|
if (fieldUnderScoreViolations.length > 0) {
|
|
169
|
-
const o = {
|
|
170
|
-
label: 'Custom fields should not contain underscores.',
|
|
171
|
-
message: `It is a best practice that Custom fields should not contain underscores.`,
|
|
172
|
-
exceptions: fieldUnderScoreViolations,
|
|
173
|
-
category: 'INTERNAL',
|
|
174
|
-
level: 'WARN'
|
|
175
|
-
};
|
|
151
|
+
const o = { ...rules_1.Rules.customrules['CUSTOM_FIELD_UNDERSCORE'], exceptions: fieldUnderScoreViolations };
|
|
176
152
|
this.violations.push(o);
|
|
177
153
|
}
|
|
178
154
|
if (fieldCZNameViolations.length > 0) {
|
|
179
|
-
const o = {
|
|
180
|
-
label: 'Custom fields in managed object should start with CZ.',
|
|
181
|
-
message: `It is a best practice that Custom fields should start with CZ in a managed object.`,
|
|
182
|
-
exceptions: fieldCZNameViolations,
|
|
183
|
-
category: 'INTERNAL',
|
|
184
|
-
level: 'WARN'
|
|
185
|
-
};
|
|
155
|
+
const o = { ...rules_1.Rules.customrules['CUSTOM_FIELD_CZ'], exceptions: fieldCZNameViolations };
|
|
186
156
|
this.violations.push(o);
|
|
187
157
|
}
|
|
188
158
|
if (tableCZNameViolations.length > 0) {
|
|
189
|
-
const o = {
|
|
190
|
-
label: 'Custom objects should start with CZ.',
|
|
191
|
-
message: `It is a best practice that Custom objects should start with CZ to avoid clash with managed package`,
|
|
192
|
-
exceptions: tableCZNameViolations,
|
|
193
|
-
category: 'INTERNAL',
|
|
194
|
-
level: 'WARN'
|
|
195
|
-
};
|
|
159
|
+
const o = { ...rules_1.Rules.customrules['CUSTOM_TAB_CZ'], exceptions: tableCZNameViolations };
|
|
196
160
|
this.violations.push(o);
|
|
197
161
|
}
|
|
198
162
|
}
|
|
199
|
-
|
|
200
|
-
|
|
163
|
+
/**
|
|
164
|
+
* scan api
|
|
165
|
+
* @param sourceFolder
|
|
166
|
+
* @param minapi
|
|
167
|
+
*/
|
|
201
168
|
async scanAPIVersion(sourceFolder, minapi) {
|
|
202
169
|
await this.scanAPIVersionByType('ApexClass', sourceFolder, 'app/main/default/classes', minapi);
|
|
203
170
|
await this.scanAPIVersionByType('ApexClass', sourceFolder, 'app/test/default/classes', minapi);
|
|
204
171
|
await this.scanAPIVersionByType('ApexTrigger', sourceFolder, 'app/main/default/triggers', minapi);
|
|
205
172
|
await this.scanAPIVersionByType('ApexPage', sourceFolder, 'app/main/default/pages', minapi);
|
|
173
|
+
if (this.apiViolations.length > 0) {
|
|
174
|
+
const o = {
|
|
175
|
+
...rules_1.Rules.customrules['MINAPI_VERSION'],
|
|
176
|
+
exceptions: this.apiViolations,
|
|
177
|
+
message: `You appear to be using a version of Metadata API less than the minimum specified. Use the ` + minapi
|
|
178
|
+
};
|
|
179
|
+
this.violations.push(o);
|
|
180
|
+
}
|
|
206
181
|
}
|
|
207
182
|
scanAPIVersionByType(type, sourceFolder, basePath, minapi) {
|
|
208
|
-
const apiViolations = [];
|
|
209
183
|
const srcPath = path.join(sourceFolder, basePath);
|
|
210
184
|
if (!(0, fs_1.existsSync)(srcPath)) {
|
|
211
185
|
return;
|
|
@@ -226,19 +200,24 @@ class MetadataScan {
|
|
|
226
200
|
else if (result) {
|
|
227
201
|
const json = result;
|
|
228
202
|
if (minapi > parseInt(json[type].apiVersion)) {
|
|
229
|
-
apiViolations.push(f);
|
|
203
|
+
this.apiViolations.push(f);
|
|
230
204
|
}
|
|
231
205
|
}
|
|
232
206
|
});
|
|
233
207
|
}
|
|
234
208
|
}
|
|
235
|
-
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* scan json files
|
|
212
|
+
*/
|
|
213
|
+
async scanJSONFiles(path, minapi) {
|
|
214
|
+
const fileContent = (0, fs_1.readFileSync)(path + '/sfdx-project.json');
|
|
215
|
+
const obj = JSON.parse(fileContent.toString());
|
|
216
|
+
if (minapi > parseInt(obj['sourceApiVersion'])) {
|
|
236
217
|
const o = {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
category: 'API',
|
|
241
|
-
level: 'FATAL'
|
|
218
|
+
...rules_1.Rules.customrules['PROJECT_API_VERSION'],
|
|
219
|
+
exceptions: ['sfdx-project.json'],
|
|
220
|
+
message: 'Please update sourceApiVersion to ' + minapi + ' sfdx-project.json'
|
|
242
221
|
};
|
|
243
222
|
this.violations.push(o);
|
|
244
223
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-scan.js","sourceRoot":"","sources":["../../../src/services/lint/metadata-scan.ts"],"names":[],"mappings":";;;AAAA;;IAEI;AACJ,2CAA0C;AAC1C,2BAA2D;AAC3D,6BAA8B;AAC9B,iCAAkC;AAClC,sFAAqD;
|
|
1
|
+
{"version":3,"file":"metadata-scan.js","sourceRoot":"","sources":["../../../src/services/lint/metadata-scan.ts"],"names":[],"mappings":";;;AAAA;;IAEI;AACJ,2CAA0C;AAC1C,2BAA2D;AAC3D,6BAA8B;AAC9B,iCAAkC;AAClC,sFAAqD;AACrD,mCAAgC;AAEhC,MAAqB,YAAY;IAE/B,YAAmB,SAAkB;QADrC,cAAS,GAAG,SAAS,CAAC;QAItB,gBAAW,GAAG,EAAE,CAAC;QACjB,eAAU,GAAc,EAAE,CAAC;QAE3B,kBAAa,GAAG,EAAE,CAAC;QALjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAMM,KAAK,CAA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AAK,CAAC,WAAW,CAAC,qBAAqB,CAAC;gBAC3C,UAAU,EAAE,CAAC,mBAAmB,CAAC;gBACjC,OAAO,EAAE,oCAAoC,GAAG,MAAM,GAAG,oBAAoB;aAC9E,CAAC;YACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACzB;IACH,CAAC;CACF;AAzOD,+BAyOC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rules = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Copyright (c) NCR Terafina
|
|
7
|
+
**/
|
|
8
|
+
const ignored_files_1 = tslib_1.__importDefault(require("../../utils/ignored-files"));
|
|
9
|
+
class Rules {
|
|
10
|
+
}
|
|
11
|
+
exports.Rules = Rules;
|
|
12
|
+
Rules.customrules = {
|
|
13
|
+
APEX_NAME_CONVENTION: {
|
|
14
|
+
label: 'Files violating naming conventions',
|
|
15
|
+
category: 'INTERNAL',
|
|
16
|
+
level: 'FATAL',
|
|
17
|
+
message: 'Classes should' + '\nend with [' + ignored_files_1.default.allowedClassNameListEnd.join(', ') + ']'
|
|
18
|
+
},
|
|
19
|
+
CUSTOM_TAB_DESCRIPTION: {
|
|
20
|
+
label: 'Custom Objects should have a description',
|
|
21
|
+
category: 'INTERNAL',
|
|
22
|
+
level: 'FATAL',
|
|
23
|
+
message: 'It is a best practice that Custom Objects have a description.'
|
|
24
|
+
},
|
|
25
|
+
CUSTOM_FIELD_DESCRIPTION: {
|
|
26
|
+
label: 'Custom Fields should have a description',
|
|
27
|
+
category: 'INTERNAL',
|
|
28
|
+
level: 'FATAL',
|
|
29
|
+
message: 'It is a best practice that Custom Fields have a description'
|
|
30
|
+
},
|
|
31
|
+
CUSTOM_FIELD_UNDERSCORE: {
|
|
32
|
+
label: 'Custom fields should not contain underscores.',
|
|
33
|
+
category: 'INTERNAL',
|
|
34
|
+
level: 'WARN',
|
|
35
|
+
message: 'It is a best practice that Custom fields should not contain underscores.'
|
|
36
|
+
},
|
|
37
|
+
CUSTOM_FIELD_CZ: {
|
|
38
|
+
label: 'Custom fields in managed object should start with CZ.',
|
|
39
|
+
category: 'INTERNAL',
|
|
40
|
+
level: 'WARN',
|
|
41
|
+
message: 'It is a best practice that Custom fields should start with CZ in a managed object.'
|
|
42
|
+
},
|
|
43
|
+
CUSTOM_TAB_CZ: {
|
|
44
|
+
label: 'Custom objects should start with CZ.',
|
|
45
|
+
category: 'INTERNAL',
|
|
46
|
+
level: 'WARN',
|
|
47
|
+
message: 'It is a best practice that Custom objects should start with CZ to avoid clash with managed package'
|
|
48
|
+
},
|
|
49
|
+
MINAPI_VERSION: {
|
|
50
|
+
label: 'Using old Metadata API Version',
|
|
51
|
+
category: 'API',
|
|
52
|
+
level: 'FATAL',
|
|
53
|
+
message: 'You appear to be using a version of Metadata API less than the minimum specified.'
|
|
54
|
+
},
|
|
55
|
+
PROJECT_API_VERSION: {
|
|
56
|
+
label: 'Project source api version using old Metadata API Version',
|
|
57
|
+
category: 'API',
|
|
58
|
+
level: 'FATAL',
|
|
59
|
+
message: 'Please update sourceApiVersion in sfdx-project.json'
|
|
60
|
+
},
|
|
61
|
+
DIRECT_ABSTRACT_CLASS: {
|
|
62
|
+
label: 'Instances of (tffa\\.AbstractRepository\\.|tffa\\.AbstractController\\.|tffa\\.AbstractRESTService\\.)',
|
|
63
|
+
category: 'INTERNAL',
|
|
64
|
+
level: 'FATAL',
|
|
65
|
+
message: 'Do not call methods directly of an abstract class . Extend the abstract class and use methods directly'
|
|
66
|
+
},
|
|
67
|
+
SOQL_REPOSITORY: {
|
|
68
|
+
label: 'Instances of (\\[select |\\[update |\\[upsert |\\[delete |\\bDatabase\\.query\\b|\\bDatabase\\.update\\b|\\bDatabase\\.insert\\b|\\bDatabase\\.upsert\\b|\\bDatabase\\.delete\\b)',
|
|
69
|
+
category: 'INTERNAL',
|
|
70
|
+
level: 'FATAL',
|
|
71
|
+
message: 'Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method '
|
|
72
|
+
},
|
|
73
|
+
NO_SUPPRESSWARNINGS: {
|
|
74
|
+
label: 'Instances of SuppressWarnings',
|
|
75
|
+
category: 'PMD',
|
|
76
|
+
level: 'WARN',
|
|
77
|
+
message: 'Do not supress PMD warnings , instead fix them '
|
|
78
|
+
},
|
|
79
|
+
NO_SYSTEM_ASSERT_HARDCODING: {
|
|
80
|
+
label: 'Instances of (System\\.assertEquals\\(true\\, true\\)|System\\.assertNotEquals\\(true\\, false\\)|System\\.assertNotEquals\\(false\\, true\\)|System\\.assert\\(true\\))',
|
|
81
|
+
category: 'PMD',
|
|
82
|
+
level: 'FATAL',
|
|
83
|
+
message: 'Apex unit tests should include at least one assertion . Do not hard code values. Use proper variables'
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../src/services/lint/rules.ts"],"names":[],"mappings":";;;;AAAA;;IAEI;AACJ,sFAAqD;AASrD,MAAa,KAAK;;AAAlB,sBA6EC;AA5Ee,iBAAW,GAAyB;IAChD,oBAAoB,EAAE;QACpB,KAAK,EAAE,oCAAoC;QAC3C,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,gBAAgB,GAAG,cAAc,GAAG,uBAAY,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG;KACnG;IACD,sBAAsB,EAAE;QACtB,KAAK,EAAE,0CAA0C;QACjD,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,+DAA+D;KACzE;IACD,wBAAwB,EAAE;QACxB,KAAK,EAAE,yCAAyC;QAChD,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,OAAO;Q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ects: string[];
|
|
10
10
|
static skipStandardObjects: string[];
|
|
11
11
|
static ignoreFiles: string[];
|
|
12
|
+
static allowedClassNameListEnd: string[];
|
|
13
|
+
static allowedClassNameListStart: string[];
|
|
12
14
|
static files: any[];
|
|
13
15
|
static logger: Logger;
|
|
14
16
|
static init(sourceFolder: string): Promise<void>;
|
|
@@ -83,7 +83,72 @@ IgnoredFiles.ignoreFiles = [
|
|
|
83
83
|
'ExpressionEvaluator',
|
|
84
84
|
'Migration_V14_0_0',
|
|
85
85
|
'Migration_V14_0_0_1',
|
|
86
|
-
'Migration_V14_0_0_2'
|
|
86
|
+
'Migration_V14_0_0_2',
|
|
87
|
+
'kycReport.page',
|
|
88
|
+
'dueDiligenceReport.page'
|
|
87
89
|
];
|
|
90
|
+
IgnoredFiles.allowedClassNameListEnd = [
|
|
91
|
+
'Repository',
|
|
92
|
+
'DTO',
|
|
93
|
+
'Request',
|
|
94
|
+
'Response',
|
|
95
|
+
'Result',
|
|
96
|
+
'Provider',
|
|
97
|
+
'Service',
|
|
98
|
+
'Controller',
|
|
99
|
+
'Constants',
|
|
100
|
+
'Job',
|
|
101
|
+
'Executor',
|
|
102
|
+
'Processor',
|
|
103
|
+
'Ext',
|
|
104
|
+
'Utlity',
|
|
105
|
+
'Utils',
|
|
106
|
+
'Util',
|
|
107
|
+
'Resolver',
|
|
108
|
+
'Factory',
|
|
109
|
+
'EventExtension',
|
|
110
|
+
'EventFactory',
|
|
111
|
+
'Exception',
|
|
112
|
+
'Calculator',
|
|
113
|
+
'Builder',
|
|
114
|
+
'Type',
|
|
115
|
+
'Logger',
|
|
116
|
+
'Context',
|
|
117
|
+
'Exporter',
|
|
118
|
+
'Status',
|
|
119
|
+
'Handler',
|
|
120
|
+
'Client',
|
|
121
|
+
'Serializer',
|
|
122
|
+
'Parser',
|
|
123
|
+
'Adapter',
|
|
124
|
+
'Configuration',
|
|
125
|
+
'Configurations',
|
|
126
|
+
'Mapper',
|
|
127
|
+
'Helper',
|
|
128
|
+
'Extension',
|
|
129
|
+
'Dom',
|
|
130
|
+
'Render',
|
|
131
|
+
'Record',
|
|
132
|
+
'Records',
|
|
133
|
+
'Generator',
|
|
134
|
+
'Formatter',
|
|
135
|
+
'Notifier',
|
|
136
|
+
'Enricher',
|
|
137
|
+
'Signer',
|
|
138
|
+
'Batch',
|
|
139
|
+
'Assigner',
|
|
140
|
+
'Dispatcher',
|
|
141
|
+
'Namespace',
|
|
142
|
+
'Interaction',
|
|
143
|
+
'Cipher',
|
|
144
|
+
'APICall',
|
|
145
|
+
'Cache',
|
|
146
|
+
'Validator',
|
|
147
|
+
'Evaluator',
|
|
148
|
+
'Matcher',
|
|
149
|
+
'Credential',
|
|
150
|
+
'Comparator'
|
|
151
|
+
];
|
|
152
|
+
IgnoredFiles.allowedClassNameListStart = ['Migration', 'SObject'];
|
|
88
153
|
IgnoredFiles.files = [];
|
|
89
154
|
//# sourceMappingURL=ignored-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignored-files.js","sourceRoot":"","sources":["../../src/utils/ignored-files.ts"],"names":[],"mappings":";AAAA;;IAEI;;;AAEJ,2CAA0C;AAC1C,2BAAkC;AAClC,wDAAwB;AAExB,MAAqB,YAAY;
|
|
1
|
+
{"version":3,"file":"ignored-files.js","sourceRoot":"","sources":["../../src/utils/ignored-files.ts"],"names":[],"mappings":";AAAA;;IAEI;;;AAEJ,2CAA0C;AAC1C,2BAAkC;AAClC,wDAAwB;AAExB,MAAqB,YAAY;IA2HxB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,YAAoB;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,aAAM,CAAC,IAAI,EAAE,CAAC;QAClC,MAAM,oBAAoB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAA,iBAAY,EAAC,YAAY,GAAG,eAAe,CAAC,CAAC;QACjE,MAAM,MAAM,GAAG,WAAW;aACvB,QAAQ,EAAE;a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AAQ;IACR,SAAS;IACT,OAAO;IACP,WAAW;IACX,WAAW;IACX,SAAS;IACT,YAAY;IACZ,YAAY;CACb,CAAC;AAEY,sCAAyB,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAErD,kBAAK,GAAG,EAAE,CAAC"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"15.0.0-rc.3","commands":{"tffa:apexdoc":{"id":"tffa:apexdoc","description":"Generate Apex API Documentation","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["Generate Apex API Documentation :\t$sfdx tffa:apexdoc "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing the workspace","multiple":false,"default":"."},"destfolder":{"name":"destfolder","type":"option","char":"d","description":"directory to generate the api docs","multiple":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing the workspace","default":".","input":[],"multiple":false,"type":"option"},"destfolder":{"kind":"directory","char":"d","description":"directory to generate the api docs","input":[],"multiple":false,"type":"option"}}},"tffa:lint":{"id":"tffa:lint","description":"scan a sfdx project and provide a violations report based on defined standards","strict":true,"usage":"<%= command.id %> [-s <directory>] [-m <integer>] [-r <filepath>] [-e] [-f] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$sfdx tffa:lint"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"generate json output","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"minapi":{"name":"minapi","type":"option","char":"m","description":"minimum api version to use during quality checks","multiple":false,"default":55},"rulesetpath":{"name":"rulesetpath","type":"option","char":"r","description":"path to pmd ruleset","multiple":false},"eject":{"name":"eject","type":"boolean","char":"e","description":"update local pmd ruleset","allowNo":false},"level":{"name":"level","type":"boolean","char":"f","description":"emit fatal violations only","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"minapi":{"kind":"integer","char":"m","description":"minimum api version to use during quality checks","default":55,"input":[],"multiple":false,"type":"option"},"json":{"kind":"boolean","char":"j","description":"generate json output","allowNo":false,"type":"boolean"},"rulesetpath":{"kind":"filepath","char":"r","description":"path to pmd ruleset","input":[],"multiple":false,"type":"option"},"eject":{"kind":"boolean","char":"e","description":"update local pmd ruleset","allowNo":false,"type":"boolean"},"level":{"kind":"boolean","char":"f","description":"emit fatal violations only","allowNo":false,"type":"boolean"}}},"tffa:meta":{"id":"tffa:meta","description":"scan a sfdx project for metadata","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["scan a sfdx project for metadata :\t$sfdx tffa:meta"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"destpath":{"name":"destpath","type":"option","char":"d","description":"full path output file","multiple":false,"default":"."},"clientname":{"name":"clientname","type":"option","char":"c","description":"name of the client","multiple":false,"default":"."},"output":{"name":"output","type":"option","char":"o","description":"output format json csv human","helpValue":"(json|csv|human)","multiple":false,"options":["json","csv","human"]},"fields":{"name":"fields","type":"boolean","char":"f","description":"generate field output","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"destpath":{"kind":"directory","char":"d","description":"full path output file","default":".","input":[],"multiple":false,"type":"option"},"clientname":{"kind":"directory","char":"c","description":"name of the client","default":".","input":[],"multiple":false,"type":"option"},"output":{"kind":"enum","helpValue":"(json|csv|human)","char":"o","options":["json","csv","human"],"description":"output format json csv human","input":[],"multiple":false,"type":"option"},"fields":{"kind":"boolean","char":"f","description":"generate field output","allowNo":false,"type":"boolean"}}},"tffa:ping":{"id":"tffa:ping","description":"ping","strict":true,"usage":"<%= command.id %> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:ping "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"}},"args":[{"name":"file"}],"flagsConfig":{}}}}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terafina/tffa-sfdx-plugin",
|
|
3
3
|
"description": "sfdx plugin from Terafina containing tools for scanning and extending digital applications for the financial services industry.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "15.0.0-rc.3",
|
|
5
5
|
"author": "Terafina Inc",
|
|
6
6
|
"bugs": "https://github.com/terafinainc/tffa-sfdx-plugin/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@oclif/core": "1.
|
|
8
|
+
"@oclif/core": "1.12.1",
|
|
9
9
|
"@oclif/plugin-help": "5.1.12",
|
|
10
10
|
"@oclif/plugin-plugins": "2.1.0",
|
|
11
11
|
"@oclif/plugin-version": "1.1.1",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"@types/fs-extra": "9.0.13",
|
|
34
34
|
"@types/js-yaml": "4.0.5",
|
|
35
35
|
"@types/mocha": "9.1.1",
|
|
36
|
-
"@types/node": "18.0.
|
|
36
|
+
"@types/node": "18.0.6",
|
|
37
37
|
"@types/xml2js": "0.4.11",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "5.30.
|
|
39
|
-
"@typescript-eslint/parser": "5.30.
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "5.30.7",
|
|
39
|
+
"@typescript-eslint/parser": "5.30.7",
|
|
40
40
|
"chai": "4",
|
|
41
41
|
"eslint": "8.20.0",
|
|
42
42
|
"eslint-config-prettier": "8.5.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-jest": "26.6.0",
|
|
47
47
|
"eslint-plugin-jsdoc": "39.3.3",
|
|
48
48
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
49
|
-
"eslint-plugin-sonarjs": "0.
|
|
49
|
+
"eslint-plugin-sonarjs": "0.14.0",
|
|
50
50
|
"globby": "11.0.1",
|
|
51
51
|
"htmlparser2": "8.0.1",
|
|
52
52
|
"husky": "8.0.1",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"prepack": "rimraf lib && tsc -b && oclif manifest && oclif readme",
|
|
110
110
|
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
|
111
111
|
"version": "oclif readme && git add README.md",
|
|
112
|
-
"publish": "git push --follow-tags origin
|
|
113
|
-
"publish_rc": "git push --follow-tags origin
|
|
112
|
+
"publish": "git push --follow-tags origin develop && npm run package && npm publish terafina-tffa-sfdx-plugin-$npm_package_version.tgz && npm dist-tag add @terafina/tffa-sfdx-plugin@$npm_package_version r$npm_config_tffa_version",
|
|
113
|
+
"publish_rc": "git push --follow-tags origin develop && npm run package && npm publish --tag next terafina-tffa-sfdx-plugin-$npm_package_version.tgz && npm dist-tag add @terafina/tffa-sfdx-plugin@$npm_package_version r$npm_config_tffa_version",
|
|
114
114
|
"package": "npm pack ",
|
|
115
115
|
"release": "standard-version --commit-all",
|
|
116
116
|
"release_rc": "npm run release -- --prerelease rc",
|