@terafina/tffa-sfdx-plugin 15.0.0-rc.4 → 15.0.0-rc.9
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 +7 -7
- package/bin/pmd/apex_ruleset.xml +108 -0
- package/bin/pmd/apex_test_ruleset.xml +1 -1
- package/lib/commands/tffa/lint.js +10 -3
- package/lib/commands/tffa/lint.js.map +1 -1
- package/lib/services/lint/eslint-scan.d.ts +13 -0
- package/lib/services/lint/eslint-scan.js +138 -0
- package/lib/services/lint/eslint-scan.js.map +1 -0
- package/lib/services/lint/stylelint-scan.d.ts +13 -0
- package/lib/services/lint/stylelint-scan.js +119 -0
- package/lib/services/lint/stylelint-scan.js.map +1 -0
- package/npm-shrinkwrap.json +26163 -0
- package/oclif.manifest.json +1 -1
- package/package.json +15 -15
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/15.0.0-rc.
|
|
44
|
+
@terafina/tffa-sfdx-plugin/15.0.0-rc.9 darwin-arm64 node-v16.16.0
|
|
45
45
|
$ sfdx --help [COMMAND]
|
|
46
46
|
USAGE
|
|
47
47
|
$ sfdx COMMAND
|
|
@@ -104,7 +104,7 @@ EXAMPLES
|
|
|
104
104
|
Generate Apex API Documentation : $sfdx tffa:apexdoc
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
_See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.
|
|
107
|
+
_See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.9/src/commands/tffa/apexdoc.ts)_
|
|
108
108
|
|
|
109
109
|
## `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]`
|
|
110
110
|
|
|
@@ -134,7 +134,7 @@ EXAMPLES
|
|
|
134
134
|
$sfdx tffa:lint
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
_See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.
|
|
137
|
+
_See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.9/src/commands/tffa/lint.ts)_
|
|
138
138
|
|
|
139
139
|
## `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]`
|
|
140
140
|
|
|
@@ -163,7 +163,7 @@ EXAMPLES
|
|
|
163
163
|
scan a sfdx project for metadata : $sfdx tffa:meta
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
_See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.
|
|
166
|
+
_See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.9/src/commands/tffa/meta.ts)_
|
|
167
167
|
|
|
168
168
|
## `sfdx tffa:ping [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
169
169
|
|
|
@@ -185,7 +185,7 @@ EXAMPLES
|
|
|
185
185
|
$ sfdx tffa:ping
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
_See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.
|
|
188
|
+
_See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.9/src/commands/tffa/ping.ts)_
|
|
189
189
|
|
|
190
190
|
## `sfdx tffa:source:apiset [-h <help>] [-s <directory>] [-a <integer>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
191
191
|
|
|
@@ -213,7 +213,7 @@ EXAMPLES
|
|
|
213
213
|
$ sfdx tffa:source:apiset
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
_See code: [src/commands/tffa/source/apiset.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.
|
|
216
|
+
_See code: [src/commands/tffa/source/apiset.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v15.0.0-rc.9/src/commands/tffa/source/apiset.ts)_
|
|
217
217
|
|
|
218
218
|
## `sfdx version`
|
|
219
219
|
|
|
@@ -233,5 +233,5 @@ FLAG DESCRIPTIONS
|
|
|
233
233
|
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v1.1.
|
|
236
|
+
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v1.1.2/src/commands/version.ts)_
|
|
237
237
|
<!-- commandsstop -->
|
package/bin/pmd/apex_ruleset.xml
CHANGED
|
@@ -115,4 +115,112 @@
|
|
|
115
115
|
</properties>
|
|
116
116
|
</rule>
|
|
117
117
|
<!-- END ERROR PRONE -->
|
|
118
|
+
<!-- CUSTOM RULES -->
|
|
119
|
+
<rule
|
|
120
|
+
name="ValidateSessionRequiredInControllerRemoteMethods"
|
|
121
|
+
language="apex"
|
|
122
|
+
message="All Custom controllers should have validateSession"
|
|
123
|
+
class="net.sourceforge.pmd.lang.apex.rule.ApexXPathRule"
|
|
124
|
+
externalInfoUrl="https://developer.terafinainc.net/development-guidelines/security-guidelines#terafina-application-security"
|
|
125
|
+
>
|
|
126
|
+
<description>All Custom controllers should have validateSession();</description>
|
|
127
|
+
<priority>1</priority>
|
|
128
|
+
<properties>
|
|
129
|
+
<property name="xpath">
|
|
130
|
+
<value>
|
|
131
|
+
<![CDATA[
|
|
132
|
+
//UserClass[(ends-with(@Image, 'Controller')) and (@SuperClassName ='tffa.AbstractController')]
|
|
133
|
+
//Method[
|
|
134
|
+
./ModifierNode/Annotation[@Image = 'RemoteAction']
|
|
135
|
+
and
|
|
136
|
+
(
|
|
137
|
+
not(.//MethodCallExpression[@MethodName='validateSession'])
|
|
138
|
+
)
|
|
139
|
+
]
|
|
140
|
+
]]>
|
|
141
|
+
</value>
|
|
142
|
+
</property>
|
|
143
|
+
</properties>
|
|
144
|
+
</rule>
|
|
145
|
+
<rule
|
|
146
|
+
name="ValidateRecordAccessRequiredInControllerRemoteMethods"
|
|
147
|
+
language="apex"
|
|
148
|
+
message="All Custom controllers should have validateRecordAccess"
|
|
149
|
+
class="net.sourceforge.pmd.lang.apex.rule.ApexXPathRule"
|
|
150
|
+
externalInfoUrl="https://developer.terafinainc.net/development-guidelines/security-guidelines#terafina-application-security"
|
|
151
|
+
>
|
|
152
|
+
<description>All Custom controllers should have validateRecordAccess();</description>
|
|
153
|
+
<priority>1</priority>
|
|
154
|
+
<properties>
|
|
155
|
+
<property name="xpath">
|
|
156
|
+
<value>
|
|
157
|
+
<![CDATA[
|
|
158
|
+
//UserClass[(ends-with(@Image, 'Controller')) and (@SuperClassName ='tffa.AbstractController')]
|
|
159
|
+
//Method[
|
|
160
|
+
./ModifierNode/Annotation[@Image = 'RemoteAction']
|
|
161
|
+
and
|
|
162
|
+
(
|
|
163
|
+
not(.//MethodCallExpression[@MethodName='validateRecordAccess'])
|
|
164
|
+
)
|
|
165
|
+
]
|
|
166
|
+
]]>
|
|
167
|
+
</value>
|
|
168
|
+
</property>
|
|
169
|
+
</properties>
|
|
170
|
+
</rule>
|
|
171
|
+
<rule
|
|
172
|
+
name="InteractionInControllerRemoteMethods"
|
|
173
|
+
language="apex"
|
|
174
|
+
message="All Custom controllers should have tffa.Interaction.begin and tffa.Interaction.close"
|
|
175
|
+
class="net.sourceforge.pmd.lang.apex.rule.ApexXPathRule"
|
|
176
|
+
externalInfoUrl="https://developer.terafinainc.net/development-guidelines/security-guidelines#terafina-application-security"
|
|
177
|
+
>
|
|
178
|
+
<description>All Custom controllers should have tffa.Interaction.begin and tffa.Interaction.close</description>
|
|
179
|
+
<priority>1</priority>
|
|
180
|
+
<properties>
|
|
181
|
+
<property name="xpath">
|
|
182
|
+
<value>
|
|
183
|
+
<![CDATA[
|
|
184
|
+
//UserClass[(ends-with(@Image, 'Controller')) and (@SuperClassName ='tffa.AbstractController')]
|
|
185
|
+
//Method[
|
|
186
|
+
./ModifierNode/Annotation[@Image = 'RemoteAction']
|
|
187
|
+
and
|
|
188
|
+
(
|
|
189
|
+
not(.//MethodCallExpression[@FullMethodName='tffa.Interaction.begin'])
|
|
190
|
+
or
|
|
191
|
+
not(.//MethodCallExpression[@FullMethodName='tffa.Interaction.close'])
|
|
192
|
+
)
|
|
193
|
+
]
|
|
194
|
+
]]>
|
|
195
|
+
</value>
|
|
196
|
+
</property>
|
|
197
|
+
</properties>
|
|
198
|
+
</rule>
|
|
199
|
+
<rule
|
|
200
|
+
name="CtxParameterInControllerRemoteMethods"
|
|
201
|
+
language="apex"
|
|
202
|
+
message="All Custom controllers should have tffa.Context ctx as first parameter"
|
|
203
|
+
class="net.sourceforge.pmd.lang.apex.rule.ApexXPathRule"
|
|
204
|
+
externalInfoUrl="https://developer.terafinainc.net/development-guidelines/security-guidelines#terafina-application-security"
|
|
205
|
+
>
|
|
206
|
+
<description>All Custom controllers should have tffa.Context ctx as first parameter</description>
|
|
207
|
+
<priority>1</priority>
|
|
208
|
+
<properties>
|
|
209
|
+
<property name="xpath">
|
|
210
|
+
<value>
|
|
211
|
+
<![CDATA[
|
|
212
|
+
//UserClass[(ends-with(@Image, 'Controller')) and (@SuperClassName ='tffa.AbstractController')]
|
|
213
|
+
//Method[
|
|
214
|
+
./ModifierNode/Annotation[@Image = 'RemoteAction']
|
|
215
|
+
and
|
|
216
|
+
(
|
|
217
|
+
not(.//Parameter[1][@Type='tffa.Context'])
|
|
218
|
+
)
|
|
219
|
+
]
|
|
220
|
+
]]>
|
|
221
|
+
</value>
|
|
222
|
+
</property>
|
|
223
|
+
</properties>
|
|
224
|
+
</rule>
|
|
225
|
+
<!--END CUSTOM RULES -->
|
|
118
226
|
</ruleset>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<exclude name="AvoidHardcodingId" />
|
|
25
25
|
</rule>
|
|
26
26
|
<rule ref="category/apex/errorprone.xml/EmptyCatchBlock" message="Avoid empty catch blocks">
|
|
27
|
-
<priority>
|
|
27
|
+
<priority>3</priority>
|
|
28
28
|
<properties>
|
|
29
29
|
<property name="allowCommentedBlocks" value="true" />
|
|
30
30
|
<property name="allowExceptionNameRegex" value="^(ignored|expected)$" />
|
|
@@ -11,6 +11,8 @@ const ignored_files_1 = tslib_1.__importDefault(require("../../utils/ignored-fil
|
|
|
11
11
|
const metadata_scan_1 = tslib_1.__importDefault(require("../../services/lint/metadata-scan"));
|
|
12
12
|
const apex_pmd_1 = tslib_1.__importDefault(require("../../services/lint/apex-pmd"));
|
|
13
13
|
const constants_1 = require("../../utils/constants");
|
|
14
|
+
const eslint_scan_1 = tslib_1.__importDefault(require("../../services/lint/eslint-scan"));
|
|
15
|
+
const stylelint_scan_1 = tslib_1.__importDefault(require("../../services/lint/stylelint-scan"));
|
|
14
16
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
17
|
const messages = core_1.Messages.loadMessages('@terafina/tffa-sfdx-plugin', 'lint');
|
|
16
18
|
class Lint extends command_1.SfdxCommand {
|
|
@@ -23,14 +25,19 @@ class Lint extends command_1.SfdxCommand {
|
|
|
23
25
|
await new apex_pmd_1.default().eject(this.flags.sourcefolder);
|
|
24
26
|
return;
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
await ignored_files_1.default.init(this.flags.sourcefolder);
|
|
28
|
-
violations = await new apex_class_scan_1.default().scan(this.flags.sourcefolder);
|
|
28
|
+
const violations = [];
|
|
29
29
|
let mViolations = [];
|
|
30
|
+
await ignored_files_1.default.init(this.flags.sourcefolder);
|
|
31
|
+
mViolations = await new apex_class_scan_1.default().scan(this.flags.sourcefolder);
|
|
32
|
+
violations.push(...mViolations);
|
|
30
33
|
mViolations = await new metadata_scan_1.default(namespace).scan(this.flags.sourcefolder, this.flags.minapi);
|
|
31
34
|
violations.push(...mViolations);
|
|
32
35
|
mViolations = await new apex_pmd_1.default().scan(this.flags.sourcefolder, this.flags.rulesetpath);
|
|
33
36
|
violations.push(...mViolations);
|
|
37
|
+
mViolations = await new eslint_scan_1.default().scan(this.flags.sourcefolder);
|
|
38
|
+
violations.push(...mViolations);
|
|
39
|
+
mViolations = await new stylelint_scan_1.default().scan(this.flags.sourcefolder);
|
|
40
|
+
violations.push(...mViolations);
|
|
34
41
|
this.printViolations(this.flags.json, violations, this.flags.level);
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../src/commands/tffa/lint.ts"],"names":[],"mappings":";AAAA;;IAEI;;;AAEJ,iDAAyD;AACzD,2CAAyD;AACzD,kGAAgE;AAChE,sFAAqD;AACrD,8FAA6D;AAC7D,oFAAmD;AACnD,qDAAkD;
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../src/commands/tffa/lint.ts"],"names":[],"mappings":";AAAA;;IAEI;;;AAEJ,iDAAyD;AACzD,2CAAyD;AACzD,kGAAgE;AAChE,sFAAqD;AACrD,8FAA6D;AAC7D,oFAAmD;AACnD,qDAAkD;AAClD,0FAAyD;AACzD,gGAA+D;AAE/D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;AAE7E,MAAqB,IAAK,SAAQ,qBAAW;IAiCpC,KAAK,CAA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C,SAAS,CAAC;QAC5B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;QAC3D,OAAO,EAAE,GAAG;KACb,CAAC;IACF,MAAM,EAAE,eAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC;QAC7D,OAAO,EAAE,qBAAS,CAAC,WAAW;KAC/B,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Logger } from '@salesforce/core';
|
|
2
|
+
/**
|
|
3
|
+
* Linter executes the eslint command
|
|
4
|
+
*/
|
|
5
|
+
export default class EslintScan {
|
|
6
|
+
ignoreFiles: any[];
|
|
7
|
+
logger: Logger;
|
|
8
|
+
paths: string[];
|
|
9
|
+
eject(sourceFolder: string): Promise<unknown[]>;
|
|
10
|
+
scan(sourceFolder: string): Promise<any[]>;
|
|
11
|
+
private executeCmd;
|
|
12
|
+
private parseProblems;
|
|
13
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) NCR Terafina
|
|
6
|
+
**/
|
|
7
|
+
const ChildProcess = tslib_1.__importStar(require("child_process"));
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
9
|
+
const core_1 = require("@salesforce/core");
|
|
10
|
+
const ignored_files_1 = tslib_1.__importDefault(require("../../utils/ignored-files"));
|
|
11
|
+
/**
|
|
12
|
+
* Linter executes the eslint command
|
|
13
|
+
*/
|
|
14
|
+
class EslintScan {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.ignoreFiles = [];
|
|
17
|
+
this.paths = ['"ui/**/*.ts"', '"ui/**/*.html"', '"app/main/default/lwc"'];
|
|
18
|
+
}
|
|
19
|
+
async eject(sourceFolder) {
|
|
20
|
+
this.logger.warn(sourceFolder);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
async scan(sourceFolder) {
|
|
25
|
+
this.logger = await core_1.Logger.root();
|
|
26
|
+
this.ignoreFiles.push(...ignored_files_1.default.files);
|
|
27
|
+
this.logger.debug(this.ignoreFiles);
|
|
28
|
+
try {
|
|
29
|
+
const data = await this.executeCmd(sourceFolder);
|
|
30
|
+
const violations = this.parseProblems(data, sourceFolder);
|
|
31
|
+
return violations;
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
console.error(err);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async executeCmd(sourceFolder) {
|
|
39
|
+
const commandBufferSize = 64;
|
|
40
|
+
const eslintBinPath = path.join('node_modules', '.bin', 'eslint');
|
|
41
|
+
const rulesetsArg = this.paths.join(' ');
|
|
42
|
+
const cmd = `"${eslintBinPath}" ${rulesetsArg} --no-error-on-unmatched-pattern -f json`;
|
|
43
|
+
this.logger.info('eslint Command: ' + cmd);
|
|
44
|
+
const eslintCmd = ChildProcess.exec(cmd, {
|
|
45
|
+
cwd: sourceFolder,
|
|
46
|
+
maxBuffer: Math.max(commandBufferSize, 1) * 1024 * 1024
|
|
47
|
+
});
|
|
48
|
+
let stdout = '';
|
|
49
|
+
let stderr = '';
|
|
50
|
+
const eslintPromise = new Promise((resolve, reject) => {
|
|
51
|
+
eslintCmd.addListener('error', e => {
|
|
52
|
+
this.logger.error('error:' + e);
|
|
53
|
+
reject(e);
|
|
54
|
+
});
|
|
55
|
+
eslintCmd.addListener('exit', e => {
|
|
56
|
+
if (e !== 0 && e !== 4) {
|
|
57
|
+
this.logger.error(`Failed Exit Code: ${e}` + stderr);
|
|
58
|
+
reject(stderr);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
resolve(stdout);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
eslintCmd.stdout.on('data', (m) => {
|
|
65
|
+
this.logger.info('stdout:' + m);
|
|
66
|
+
stdout += m;
|
|
67
|
+
});
|
|
68
|
+
eslintCmd.stderr.on('data', (m) => {
|
|
69
|
+
this.logger.error('stderr:' + m);
|
|
70
|
+
stderr += m;
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return eslintPromise;
|
|
74
|
+
}
|
|
75
|
+
parseProblems(json, sourceFolder) {
|
|
76
|
+
let violations = [];
|
|
77
|
+
this.logger.debug(json);
|
|
78
|
+
if (!json) {
|
|
79
|
+
return violations;
|
|
80
|
+
}
|
|
81
|
+
const p = JSON.parse(json);
|
|
82
|
+
if (!p.length) {
|
|
83
|
+
return violations;
|
|
84
|
+
}
|
|
85
|
+
const violationMap = new Map();
|
|
86
|
+
for (const f of p) {
|
|
87
|
+
const file = f.filePath;
|
|
88
|
+
const filename = path.basename(file);
|
|
89
|
+
const fileRelPath = path.relative(sourceFolder, file);
|
|
90
|
+
if (this.ignoreFiles.indexOf(filename) >= 0 || this.ignoreFiles.indexOf(file) >= 0 || this.ignoreFiles.indexOf(fileRelPath) >= 0) {
|
|
91
|
+
this.logger.warn('Ignore file ' + filename);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (f.messages.length > 0) {
|
|
95
|
+
for (const v of f.messages) {
|
|
96
|
+
const key = v.ruleset + '-' + v.message;
|
|
97
|
+
let o = violationMap.get(key);
|
|
98
|
+
if (!o) {
|
|
99
|
+
o = {
|
|
100
|
+
label: v.ruleId,
|
|
101
|
+
message: v.message,
|
|
102
|
+
category: 'ESLINT',
|
|
103
|
+
level: v.severity > 1 ? 'FATAL' : 'WARN',
|
|
104
|
+
exceptions: [fileRelPath + '#' + v.line]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
o.exceptions = [fileRelPath + '#' + v.line, ...o.exceptions];
|
|
109
|
+
}
|
|
110
|
+
violationMap.set(key, o);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (f.suppressedMessages.length > 0) {
|
|
114
|
+
for (const v of f.suppressedMessages) {
|
|
115
|
+
const key = 'suppressed' + '-' + v.ruleset + '-' + v.message;
|
|
116
|
+
let o = violationMap.get(key);
|
|
117
|
+
if (!o) {
|
|
118
|
+
o = {
|
|
119
|
+
label: '[SUPPRESSED] ' + v.ruleId,
|
|
120
|
+
message: 'Do Not Supress ' + v.message + ' Please fix it.',
|
|
121
|
+
category: 'ESLINT',
|
|
122
|
+
level: v.severity > 1 ? 'FATAL' : 'WARN',
|
|
123
|
+
exceptions: [fileRelPath + '#' + v.line]
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
o.exceptions = [fileRelPath + '#' + v.line, ...o.exceptions];
|
|
128
|
+
}
|
|
129
|
+
violationMap.set(key, o);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
violations = Array.from(violationMap.values());
|
|
134
|
+
return violations;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.default = EslintScan;
|
|
138
|
+
//# sourceMappingURL=eslint-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-scan.js","sourceRoot":"","sources":["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4BAClB,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;4BACxC,UAAU,EAAE,CAAC,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;yBACzC,CAAC;qBACH;yBAAM;wBACL,CAAC,CAAC,UAAU,GAAG,CAAC,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;qBAC9D;oBACD,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;iBAC1B;aACF;SACF;QACD,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QAE/C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAjID,6BAiIC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Logger } from '@salesforce/core';
|
|
2
|
+
/**
|
|
3
|
+
* Linter executes the stylelint command
|
|
4
|
+
*/
|
|
5
|
+
export default class StylelintScan {
|
|
6
|
+
ignoreFiles: any[];
|
|
7
|
+
logger: Logger;
|
|
8
|
+
paths: string[];
|
|
9
|
+
eject(sourceFolder: string): Promise<unknown[]>;
|
|
10
|
+
scan(sourceFolder: string): Promise<any[]>;
|
|
11
|
+
private executeCmd;
|
|
12
|
+
private parseProblems;
|
|
13
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) NCR Terafina
|
|
6
|
+
**/
|
|
7
|
+
const ChildProcess = tslib_1.__importStar(require("child_process"));
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
9
|
+
const core_1 = require("@salesforce/core");
|
|
10
|
+
const ignored_files_1 = tslib_1.__importDefault(require("../../utils/ignored-files"));
|
|
11
|
+
/**
|
|
12
|
+
* Linter executes the stylelint command
|
|
13
|
+
*/
|
|
14
|
+
class StylelintScan {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.ignoreFiles = [];
|
|
17
|
+
this.paths = ['"ui/**/*.scss"'];
|
|
18
|
+
}
|
|
19
|
+
async eject(sourceFolder) {
|
|
20
|
+
this.logger.warn(sourceFolder);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
async scan(sourceFolder) {
|
|
24
|
+
this.logger = await core_1.Logger.root();
|
|
25
|
+
this.ignoreFiles.push(...ignored_files_1.default.files);
|
|
26
|
+
this.logger.debug(this.ignoreFiles);
|
|
27
|
+
try {
|
|
28
|
+
const data = await this.executeCmd(sourceFolder);
|
|
29
|
+
const violations = this.parseProblems(data, sourceFolder);
|
|
30
|
+
return violations;
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
console.error(err);
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async executeCmd(sourceFolder) {
|
|
38
|
+
const commandBufferSize = 64;
|
|
39
|
+
const stylelintBinPath = path.join('node_modules', '.bin', 'stylelint');
|
|
40
|
+
const configPath = path.join('scripts', 'stylelint', '.stylelintrc.json');
|
|
41
|
+
const rulesetsArg = this.paths.join(' ');
|
|
42
|
+
const cmd = `"${stylelintBinPath}" ${rulesetsArg} --config ${configPath} -f json`;
|
|
43
|
+
this.logger.info('stylelint Command: ' + cmd);
|
|
44
|
+
const stylelintCmd = ChildProcess.exec(cmd, {
|
|
45
|
+
cwd: sourceFolder,
|
|
46
|
+
maxBuffer: Math.max(commandBufferSize, 1) * 1024 * 1024
|
|
47
|
+
});
|
|
48
|
+
let stdout = '';
|
|
49
|
+
let stderr = '';
|
|
50
|
+
const stylelintPromise = new Promise((resolve, reject) => {
|
|
51
|
+
stylelintCmd.addListener('error', e => {
|
|
52
|
+
this.logger.error('error:' + e);
|
|
53
|
+
reject(e);
|
|
54
|
+
});
|
|
55
|
+
stylelintCmd.addListener('exit', e => {
|
|
56
|
+
if (e !== 0 && e !== 4 && e !== 2) {
|
|
57
|
+
this.logger.error(`Failed Exit Code: ${e}` + stderr);
|
|
58
|
+
reject(stderr);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
resolve(stdout);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
stylelintCmd.stdout.on('data', (m) => {
|
|
65
|
+
this.logger.info('stdout:' + m);
|
|
66
|
+
stdout += m;
|
|
67
|
+
});
|
|
68
|
+
stylelintCmd.stderr.on('data', (m) => {
|
|
69
|
+
this.logger.error('stderr:' + m);
|
|
70
|
+
stderr += m;
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return stylelintPromise;
|
|
74
|
+
}
|
|
75
|
+
parseProblems(json, sourceFolder) {
|
|
76
|
+
let violations = [];
|
|
77
|
+
this.logger.debug(json);
|
|
78
|
+
if (!json) {
|
|
79
|
+
return violations;
|
|
80
|
+
}
|
|
81
|
+
const p = JSON.parse(json);
|
|
82
|
+
if (!p.length) {
|
|
83
|
+
return violations;
|
|
84
|
+
}
|
|
85
|
+
const violationMap = new Map();
|
|
86
|
+
for (const f of p) {
|
|
87
|
+
const file = f.source;
|
|
88
|
+
const filename = path.basename(file);
|
|
89
|
+
const fileRelPath = path.relative(sourceFolder, file);
|
|
90
|
+
if (this.ignoreFiles.indexOf(filename) >= 0 || this.ignoreFiles.indexOf(file) >= 0 || this.ignoreFiles.indexOf(fileRelPath) >= 0) {
|
|
91
|
+
this.logger.warn('Ignore file ' + filename);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (f.warnings.length > 0) {
|
|
95
|
+
for (const v of f.warnings) {
|
|
96
|
+
const key = v.ruleset + '-' + v.text;
|
|
97
|
+
let o = violationMap.get(key);
|
|
98
|
+
if (!o) {
|
|
99
|
+
o = {
|
|
100
|
+
label: v.rule,
|
|
101
|
+
message: v.text,
|
|
102
|
+
category: 'STYLELINT',
|
|
103
|
+
level: v.severity === 'error' ? 'FATAL' : 'WARN',
|
|
104
|
+
exceptions: [fileRelPath + '#' + v.line]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
o.exceptions = [fileRelPath + '#' + v.line, ...o.exceptions];
|
|
109
|
+
}
|
|
110
|
+
violationMap.set(key, o);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
violations = Array.from(violationMap.values());
|
|
115
|
+
return violations;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.default = StylelintScan;
|
|
119
|
+
//# sourceMappingURL=stylelint-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylelint-scan.js","sourceRoot":"","sources":["../../../src/services/lint/stylelint-scan.ts"],"names":[],"mappings":";;;AAAA;;IAEI;AACJ,oEAA8C;AAC9C,mDAA6B;AAC7B,2CAA0C;AAC1C,sFAAqD;AAErD;;GAEG;AACH,MAAqB,aAAa;IAAlC;QACE,gBAAW,GAAG,EAAE,CAAC;QAEjB,UAAK,GAAG,CAAC,gBAAgB,CAAC,CAAC;IA4G7B,CAAC;IA1GQ,KAAK,CAAC,KAAK,CAAC,YAAoB;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/B,OAAO;IACT,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,YAAoB;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,aAAM,CAAC,IAAI,EAAE,CAAC;QAElC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,uBAAY,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEpC,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YACjD,MAAM,UAAU,GAAG,IA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