@sasjs/lint 2.3.1 → 2.4.1
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/.all-contributorsrc +11 -1
- package/README.md +50 -23
- package/package.json +1 -1
- package/rules/file/hasRequiredMacroOptions.d.ts +5 -0
- package/rules/file/hasRequiredMacroOptions.js +44 -0
- package/rules/file/hasRequiredMacroOptions.js.map +1 -0
- package/rules/file/index.d.ts +1 -0
- package/rules/file/index.js +3 -1
- package/rules/file/index.js.map +1 -1
- package/sasjslint-schema.json +29 -2
- package/types/LintConfig.d.ts +1 -0
- package/types/LintConfig.js +20 -0
- package/types/LintConfig.js.map +1 -1
package/.all-contributorsrc
CHANGED
|
@@ -101,6 +101,15 @@
|
|
|
101
101
|
"test",
|
|
102
102
|
"review"
|
|
103
103
|
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"login": "McGwire-Jones",
|
|
107
|
+
"name": "McGwire-Jones",
|
|
108
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/51411005?v=4",
|
|
109
|
+
"profile": "https://github.com/McGwire-Jones",
|
|
110
|
+
"contributions": [
|
|
111
|
+
"code"
|
|
112
|
+
]
|
|
104
113
|
}
|
|
105
114
|
],
|
|
106
115
|
"contributorsPerLine": 7,
|
|
@@ -109,5 +118,6 @@
|
|
|
109
118
|
"repoType": "github",
|
|
110
119
|
"repoHost": "https://github.com",
|
|
111
120
|
"skipCi": true,
|
|
112
|
-
"commitConvention": "none"
|
|
121
|
+
"commitConvention": "none",
|
|
122
|
+
"commitType": "docs"
|
|
113
123
|
}
|
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
Our goal is to help SAS developers everywhere spend less time on code reviews, bug fixing and arguing about standards - and more time delivering extraordinary business value.
|
|
10
10
|
|
|
11
|
+
*Note:* The SASjs project and its repositories are not affiliated with SAS Institute.
|
|
12
|
+
|
|
11
13
|
# Linting
|
|
12
14
|
|
|
13
15
|
@sasjs/lint is used by the following products:
|
|
@@ -19,10 +21,11 @@ Configuration is via a `.sasjslint` file with the following structure (these are
|
|
|
19
21
|
|
|
20
22
|
```json
|
|
21
23
|
{
|
|
22
|
-
"noEncodedPasswords": true,
|
|
23
24
|
"hasDoxygenHeader": true,
|
|
24
25
|
"hasMacroNameInMend": true,
|
|
25
26
|
"hasMacroParentheses": true,
|
|
27
|
+
"hasRequiredMacroOptions": false,
|
|
28
|
+
"requiredMacroOptions": ["SECURE", "SRC"],
|
|
26
29
|
"ignoreList": ["sasjsbuild/", "sasjsresults/"],
|
|
27
30
|
"indentationMultiple": 2,
|
|
28
31
|
"lineEndings": "off",
|
|
@@ -30,6 +33,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are
|
|
|
30
33
|
"maxDataLineLength": 80,
|
|
31
34
|
"maxHeaderLineLength": 80,
|
|
32
35
|
"maxLineLength": 80,
|
|
36
|
+
"noEncodedPasswords": true,
|
|
33
37
|
"noNestedMacros": true,
|
|
34
38
|
"noGremlins": true,
|
|
35
39
|
"noSpacesInFileNames": true,
|
|
@@ -86,13 +90,6 @@ If creating a new value, use `{lineEnding}` instead of `\n`, eg as follows:
|
|
|
86
90
|
}
|
|
87
91
|
```
|
|
88
92
|
|
|
89
|
-
### noEncodedPasswords
|
|
90
|
-
|
|
91
|
-
This rule will highlight any rows that contain a `{sas00X}` type password, or `{sasenc}`. These passwords (especially 001 and 002) are NOT secure, and should NEVER be pushed to source control or saved to the filesystem without special permissions applied.
|
|
92
|
-
|
|
93
|
-
- Default: true
|
|
94
|
-
- Severity: ERROR
|
|
95
|
-
|
|
96
93
|
### hasDoxygenHeader
|
|
97
94
|
|
|
98
95
|
The SASjs framework recommends the use of Doxygen headers for describing all types of SAS program. This check will identify files where a doxygen header does not begin in the first line.
|
|
@@ -114,6 +111,21 @@ As per the example [here](https://github.com/sasjs/lint/issues/20), macros defin
|
|
|
114
111
|
- Default: true
|
|
115
112
|
- Severity: WARNING
|
|
116
113
|
|
|
114
|
+
### hasRequiredMacroOptions
|
|
115
|
+
|
|
116
|
+
This will require macros to have the options listed as "requiredMacroOptions." This is helpful if you want to ensure all macros are SECURE.
|
|
117
|
+
|
|
118
|
+
- Default: false
|
|
119
|
+
- severity: WARNING
|
|
120
|
+
|
|
121
|
+
Example
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"hasRequiredMacroOptions": true,
|
|
125
|
+
"requiredMacroOptions": ["SECURE", "SRC"]
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
117
129
|
### ignoreList
|
|
118
130
|
|
|
119
131
|
There may be specific files (or folders) that are not good candidates for linting. Simply list them in this array and they will be ignored. In addition, any files in the project `.gitignore` file will also be ignored.
|
|
@@ -202,6 +214,13 @@ See also:
|
|
|
202
214
|
- [maxDataLineLength](#maxdatalinelength)
|
|
203
215
|
- [maxHeaderLineLength](#maxheaderlinelength)
|
|
204
216
|
|
|
217
|
+
### noEncodedPasswords
|
|
218
|
+
|
|
219
|
+
This rule will highlight any rows that contain a `{sas00X}` type password, or `{sasenc}`. These passwords (especially 001 and 002) are NOT secure, and should NEVER be pushed to source control or saved to the filesystem without special permissions applied.
|
|
220
|
+
|
|
221
|
+
- Default: true
|
|
222
|
+
- Severity: ERROR
|
|
223
|
+
|
|
205
224
|
### noGremlins
|
|
206
225
|
|
|
207
226
|
Capture zero-width whitespace and other non-standard characters. The logic is borrowed from the [VSCode Gremlins Extension](https://github.com/nhoizey/vscode-gremlins) - if you are looking for more advanced gremlin zapping capabilities, we highly recommend to use their extension instead.
|
|
@@ -252,6 +271,7 @@ This will highlight lines with trailing spaces. Trailing spaces serve no useful
|
|
|
252
271
|
- Default: true
|
|
253
272
|
- severity: WARNING
|
|
254
273
|
|
|
274
|
+
|
|
255
275
|
## severityLevel
|
|
256
276
|
|
|
257
277
|
This setting allows the default severity to be adjusted. This is helpful when running the lint in a pipeline or git hook. Simply list the rules you would like to adjust along with the desired setting ("warn" or "error"), eg as follows:
|
|
@@ -290,6 +310,12 @@ We're looking to implement the following rules:
|
|
|
290
310
|
|
|
291
311
|
We are also investigating some harder stuff, such as automatic indentation and code layout
|
|
292
312
|
|
|
313
|
+
# Further resources
|
|
314
|
+
|
|
315
|
+
* Using the linter on terminal: https://vid.4gl.io/w/vmJspCjcBoc5QtzwZkZRvi
|
|
316
|
+
* Longer intro to sasjs lint: https://vid.4gl.io/w/nDtkQFV1E8rtaa2BuM6U5s
|
|
317
|
+
* CLI docs: https://cli.sasjs.io/lint
|
|
318
|
+
|
|
293
319
|
# Sponsorship & Contributions
|
|
294
320
|
|
|
295
321
|
SASjs is an open source framework! Contributions are welcomed. If you would like to see a feature, because it would be useful in your project, but you don't have the requisite (Typescript) experience - then how about you engage us on a short project and we build it for you?
|
|
@@ -299,9 +325,7 @@ Contact [Allan Bowe](https://www.linkedin.com/in/allanbowe/) for further details
|
|
|
299
325
|
# Contributors ✨
|
|
300
326
|
|
|
301
327
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
302
|
-
|
|
303
|
-
[](#contributors-)
|
|
304
|
-
|
|
328
|
+
[](#contributors-)
|
|
305
329
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
306
330
|
|
|
307
331
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
@@ -310,18 +334,21 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
310
334
|
<!-- prettier-ignore-start -->
|
|
311
335
|
<!-- markdownlint-disable -->
|
|
312
336
|
<table>
|
|
313
|
-
<
|
|
314
|
-
<
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
<
|
|
324
|
-
|
|
337
|
+
<tbody>
|
|
338
|
+
<tr>
|
|
339
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Carus11"><img src="https://avatars.githubusercontent.com/u/4925828?v=4?s=100" width="100px;" alt="Carus Kyle"/><br /><sub><b>Carus Kyle</b></sub></a><br /><a href="#ideas-Carus11" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
340
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/allanbowe"><img src="https://avatars.githubusercontent.com/u/4420615?v=4?s=100" width="100px;" alt="Allan Bowe"/><br /><sub><b>Allan Bowe</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Aallanbowe" title="Reviewed Pull Requests">👀</a> <a href="#video-allanbowe" title="Videos">📹</a> <a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Documentation">📖</a></td>
|
|
341
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.erudicat.com/"><img src="https://avatars.githubusercontent.com/u/25773492?v=4?s=100" width="100px;" alt="Yury Shkoda"/><br /><sub><b>Yury Shkoda</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Tests">⚠️</a> <a href="#projectManagement-YuryShkoda" title="Project Management">📆</a> <a href="#video-YuryShkoda" title="Videos">📹</a> <a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Documentation">📖</a></td>
|
|
342
|
+
<td align="center" valign="top" width="14.28%"><a href="https://krishna-acondy.io/"><img src="https://avatars.githubusercontent.com/u/2980428?v=4?s=100" width="100px;" alt="Krishna Acondy"/><br /><sub><b>Krishna Acondy</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=krishna-acondy" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=krishna-acondy" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Akrishna-acondy" title="Reviewed Pull Requests">👀</a> <a href="#infra-krishna-acondy" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#platform-krishna-acondy" title="Packaging/porting to new platform">📦</a> <a href="#maintenance-krishna-acondy" title="Maintenance">🚧</a> <a href="#content-krishna-acondy" title="Content">🖋</a></td>
|
|
343
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/saadjutt01"><img src="https://avatars.githubusercontent.com/u/8914650?v=4?s=100" width="100px;" alt="Muhammad Saad "/><br /><sub><b>Muhammad Saad </b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Asaadjutt01" title="Reviewed Pull Requests">👀</a> <a href="#mentoring-saadjutt01" title="Mentoring">🧑🏫</a> <a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Documentation">📖</a></td>
|
|
344
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sabhas"><img src="https://avatars.githubusercontent.com/u/82647447?v=4?s=100" width="100px;" alt="Sabir Hassan"/><br /><sub><b>Sabir Hassan</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=sabhas" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=sabhas" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Asabhas" title="Reviewed Pull Requests">👀</a> <a href="#ideas-sabhas" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
345
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/medjedovicm"><img src="https://avatars.githubusercontent.com/u/18329105?v=4?s=100" width="100px;" alt="Mihajlo Medjedovic"/><br /><sub><b>Mihajlo Medjedovic</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=medjedovicm" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=medjedovicm" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Amedjedovicm" title="Reviewed Pull Requests">👀</a> <a href="#infra-medjedovicm" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
346
|
+
</tr>
|
|
347
|
+
<tr>
|
|
348
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/VladislavParhomchik"><img src="https://avatars.githubusercontent.com/u/83717836?v=4?s=100" width="100px;" alt="Vladislav Parhomchik"/><br /><sub><b>Vladislav Parhomchik</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=VladislavParhomchik" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3AVladislavParhomchik" title="Reviewed Pull Requests">👀</a></td>
|
|
349
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/McGwire-Jones"><img src="https://avatars.githubusercontent.com/u/51411005?v=4?s=100" width="100px;" alt="McGwire-Jones"/><br /><sub><b>McGwire-Jones</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=McGwire-Jones" title="Code">💻</a></td>
|
|
350
|
+
</tr>
|
|
351
|
+
</tbody>
|
|
325
352
|
</table>
|
|
326
353
|
|
|
327
354
|
<!-- markdownlint-restore -->
|
package/package.json
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasRequiredMacroOptions = void 0;
|
|
4
|
+
var types_1 = require("../../types");
|
|
5
|
+
var LintRuleType_1 = require("../../types/LintRuleType");
|
|
6
|
+
var parseMacros_1 = require("../../utils/parseMacros");
|
|
7
|
+
var name = 'hasRequiredMacroOptions';
|
|
8
|
+
var description = 'Enforce required macro options';
|
|
9
|
+
var message = 'Macro defined without required options';
|
|
10
|
+
var processOptions = function (macro, diagnostics, config) {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
var optionsPresent = (_c = (_b = (_a = macro.declaration.split('/')) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
|
|
13
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || types_1.Severity.Warning;
|
|
14
|
+
config === null || config === void 0 ? void 0 : config.requiredMacroOptions.forEach(function (option) {
|
|
15
|
+
if (!optionsPresent.includes(option)) {
|
|
16
|
+
diagnostics.push({
|
|
17
|
+
message: "Macro '" + macro.name + "' does not contain the required option '" + option + "'",
|
|
18
|
+
lineNumber: macro.startLineNumbers[0],
|
|
19
|
+
startColumnNumber: 0,
|
|
20
|
+
endColumnNumber: 0,
|
|
21
|
+
severity: severity
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var test = function (value, config) {
|
|
27
|
+
var diagnostics = [];
|
|
28
|
+
var macros = parseMacros_1.parseMacros(value, config);
|
|
29
|
+
macros.forEach(function (macro) {
|
|
30
|
+
processOptions(macro, diagnostics, config);
|
|
31
|
+
});
|
|
32
|
+
return diagnostics;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Lint rule that checks if a macro has the required options
|
|
36
|
+
*/
|
|
37
|
+
exports.hasRequiredMacroOptions = {
|
|
38
|
+
type: LintRuleType_1.LintRuleType.File,
|
|
39
|
+
name: name,
|
|
40
|
+
description: description,
|
|
41
|
+
message: message,
|
|
42
|
+
test: test
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=hasRequiredMacroOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasRequiredMacroOptions.js","sourceRoot":"","sources":["../../../src/rules/file/hasRequiredMacroOptions.ts"],"names":[],"mappings":";;;AAAA,qCAAqE;AAErE,yDAAuD;AACvD,uDAAqD;AAErD,IAAM,IAAI,GAAG,yBAAyB,CAAA;AACtC,IAAM,WAAW,GAAG,gCAAgC,CAAA;AACpD,IAAM,OAAO,GAAG,wCAAw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;IACP,IAAI,MAAA;CACL,CAAA"}
|
package/rules/file/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { hasMacroParentheses } from './hasMacroParentheses';
|
|
|
4
4
|
export { lineEndings } from './lineEndings';
|
|
5
5
|
export { noNestedMacros } from './noNestedMacros';
|
|
6
6
|
export { strictMacroDefinition } from './strictMacroDefinition';
|
|
7
|
+
export { hasRequiredMacroOptions } from './hasRequiredMacroOptions';
|
package/rules/file/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.strictMacroDefinition = exports.noNestedMacros = exports.lineEndings = exports.hasMacroParentheses = exports.hasMacroNameInMend = exports.hasDoxygenHeader = void 0;
|
|
3
|
+
exports.hasRequiredMacroOptions = exports.strictMacroDefinition = exports.noNestedMacros = exports.lineEndings = exports.hasMacroParentheses = exports.hasMacroNameInMend = exports.hasDoxygenHeader = void 0;
|
|
4
4
|
var hasDoxygenHeader_1 = require("./hasDoxygenHeader");
|
|
5
5
|
Object.defineProperty(exports, "hasDoxygenHeader", { enumerable: true, get: function () { return hasDoxygenHeader_1.hasDoxygenHeader; } });
|
|
6
6
|
var hasMacroNameInMend_1 = require("./hasMacroNameInMend");
|
|
@@ -13,4 +13,6 @@ var noNestedMacros_1 = require("./noNestedMacros");
|
|
|
13
13
|
Object.defineProperty(exports, "noNestedMacros", { enumerable: true, get: function () { return noNestedMacros_1.noNestedMacros; } });
|
|
14
14
|
var strictMacroDefinition_1 = require("./strictMacroDefinition");
|
|
15
15
|
Object.defineProperty(exports, "strictMacroDefinition", { enumerable: true, get: function () { return strictMacroDefinition_1.strictMacroDefinition; } });
|
|
16
|
+
var hasRequiredMacroOptions_1 = require("./hasRequiredMacroOptions");
|
|
17
|
+
Object.defineProperty(exports, "hasRequiredMacroOptions", { enumerable: true, get: function () { return hasRequiredMacroOptions_1.hasRequiredMacroOptions; } });
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/rules/file/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/file/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAC3B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AACpB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AACvB,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/file/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAC3B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AACpB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AACvB,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA;AAC9B,qEAAmE;AAA1D,kIAAA,uBAAuB,OAAA"}
|
package/sasjslint-schema.json
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"noTrailingSpaces": true,
|
|
23
23
|
"lineEndings": "off",
|
|
24
24
|
"strictMacroDefinition": true,
|
|
25
|
-
"ignoreList": ["sajsbuild", "sasjsresults"]
|
|
25
|
+
"ignoreList": ["sajsbuild", "sasjsresults"],
|
|
26
|
+
"hasRequiredMacroOptions": false,
|
|
27
|
+
"requiredMacroOptions": []
|
|
26
28
|
},
|
|
27
29
|
"examples": [
|
|
28
30
|
{
|
|
@@ -43,7 +45,9 @@
|
|
|
43
45
|
"hasMacroParentheses": true,
|
|
44
46
|
"lineEndings": "crlf",
|
|
45
47
|
"strictMacroDefinition": true,
|
|
46
|
-
"ignoreList": ["sajsbuild", "sasjsresults"]
|
|
48
|
+
"ignoreList": ["sajsbuild", "sasjsresults"],
|
|
49
|
+
"hasRequiredMacroOptions": false,
|
|
50
|
+
"requiredMacroOptions": []
|
|
47
51
|
}
|
|
48
52
|
],
|
|
49
53
|
"properties": {
|
|
@@ -204,6 +208,22 @@
|
|
|
204
208
|
"default": ["sasjsbuild/", "sasjsresults/"],
|
|
205
209
|
"examples": ["sasjs/tests", "tmp/scratch.sas"]
|
|
206
210
|
},
|
|
211
|
+
"hasRequiredMacroOptions": {
|
|
212
|
+
"$id": "#/properties/hasRequiredMacroOptions",
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"title": "hasRequiredMacroOptions",
|
|
215
|
+
"description": "Enforces required macro options as defined by requiredMacroOptions",
|
|
216
|
+
"default": false,
|
|
217
|
+
"examples": [true, false]
|
|
218
|
+
},
|
|
219
|
+
"requiredMacroOptions": {
|
|
220
|
+
"$id": "#/properties/requiredMacroOptions",
|
|
221
|
+
"type": "array",
|
|
222
|
+
"title": "requiredMacroOptions",
|
|
223
|
+
"description": "An array of macro options to require all macros to include.",
|
|
224
|
+
"default": [],
|
|
225
|
+
"examples": ["['SECURE']", "['SRC', 'STMT']"]
|
|
226
|
+
},
|
|
207
227
|
"severityLevel": {
|
|
208
228
|
"$id": "#/properties/severityLevel",
|
|
209
229
|
"type": "object",
|
|
@@ -320,6 +340,13 @@
|
|
|
320
340
|
"type": "string",
|
|
321
341
|
"enum": ["error", "warn"],
|
|
322
342
|
"default": "warn"
|
|
343
|
+
},
|
|
344
|
+
"hasRequiredMacroOptions": {
|
|
345
|
+
"$id": "#/properties/severityLevel/hasRequiredMacroOptions",
|
|
346
|
+
"title": "hasRequiredMacroOptions",
|
|
347
|
+
"type": "string",
|
|
348
|
+
"enum": ["error", "warn"],
|
|
349
|
+
"default": "warn"
|
|
323
350
|
}
|
|
324
351
|
}
|
|
325
352
|
}
|
package/types/LintConfig.d.ts
CHANGED
package/types/LintConfig.js
CHANGED
|
@@ -57,6 +57,7 @@ var LintConfig = /** @class */ (function () {
|
|
|
57
57
|
this.lineEndings = LineEndings_1.LineEndings.LF;
|
|
58
58
|
this.defaultHeader = utils_1.getDefaultHeader();
|
|
59
59
|
this.severityLevel = {};
|
|
60
|
+
this.requiredMacroOptions = [];
|
|
60
61
|
if (json === null || json === void 0 ? void 0 : json.ignoreList) {
|
|
61
62
|
if (Array.isArray(json.ignoreList)) {
|
|
62
63
|
json.ignoreList.forEach(function (item) {
|
|
@@ -126,6 +127,25 @@ var LintConfig = /** @class */ (function () {
|
|
|
126
127
|
if ((json === null || json === void 0 ? void 0 : json.strictMacroDefinition) !== false) {
|
|
127
128
|
this.fileLintRules.push(file_1.strictMacroDefinition);
|
|
128
129
|
}
|
|
130
|
+
if (json === null || json === void 0 ? void 0 : json.hasRequiredMacroOptions) {
|
|
131
|
+
this.fileLintRules.push(file_1.hasRequiredMacroOptions);
|
|
132
|
+
if (json === null || json === void 0 ? void 0 : json.requiredMacroOptions) {
|
|
133
|
+
if (Array.isArray(json.requiredMacroOptions) &&
|
|
134
|
+
json.requiredMacroOptions.length > 0) {
|
|
135
|
+
json.requiredMacroOptions.forEach(function (item) {
|
|
136
|
+
if (typeof item === 'string') {
|
|
137
|
+
_this.requiredMacroOptions.push(item);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
throw new Error("Property \"requiredMacroOptions\" has invalid type of values. It can only contain strings.");
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
throw new Error("Property \"requiredMacroOptions\" can only be an array of strings.");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
129
149
|
if ((json === null || json === void 0 ? void 0 : json.noGremlins) !== false) {
|
|
130
150
|
this.lineLintRules.push(line_1.noGremlins);
|
|
131
151
|
if (json === null || json === void 0 ? void 0 : json.allowedGremlins) {
|
package/types/LintConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LintConfig.js","sourceRoot":"","sources":["../../src/types/LintConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"LintConfig.js","sourceRoot":"","sources":["../../src/types/LintConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAQsB;AACtB,sCAOsB;AACtB,sCAAuE;AACvE,6CAA2C;AAE3C,kCAA2C;AAC3C,uCAAqC;AAErC;;;;;;GAMG;AACH;IAeE,oBAAY,IAAU;;QAAtB,iBA+IC;QA7JQ,eAAU,GAAa,EAAE,CAAA;QACzB,oBAAe,GAAa,EAAE,CAAA;QAC9B,kBAAa,GAAmB,EAAE,CAAA;QAClC,kBAAa,GAAmB,EAAE,CAAA;QAClC,kBAAa,GAAmB,EAAE,CAAA;QAClC,kBAAa,GAAW,EAAE,CAAA;QAC1B,wBAAmB,GAAW,EAAE,CAAA;QAChC,sBAAiB,GAAW,EAAE,CAAA;QAC9B,wBAAmB,GAAW,CAAC,CAAA;QAC/B,gBAAW,GAAgB,yBAAW,CAAC,EAAE,CAAA;QACzC,kBAAa,GAAW,wBAAgB,EAAE,CAAA;QAC1C,kBAAa,GAAgC,EAAE,CAAA;QAC/C,yBAAoB,GAAa,EAAE,CAAA;QAG1C,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,EAAE;YACpB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBAClC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,IAAS;oBAChC,IAAI,OAAO,IAAI,KAAK,QAAQ;wBAAE,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;;wBAEtD,MAAM,IAAI,KAAK,CACb,kFAAgF,CACjF,CAAA;gBACL,CAAC,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,IAAI,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