@sasjs/lint 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -6
- package/package.json +1 -1
- package/rules/line/index.d.ts +1 -0
- package/rules/line/index.js +3 -1
- package/rules/line/index.js.map +1 -1
- package/rules/line/noBannedStrings.d.ts +6 -0
- package/rules/line/noBannedStrings.js +74 -0
- package/rules/line/noBannedStrings.js.map +1 -0
- package/sasjslint-schema.json +36 -1
- package/types/LintConfig.d.ts +1 -0
- package/types/LintConfig.js +26 -0
- package/types/LintConfig.js.map +1 -1
- package/utils/defaultBannedStrings.d.ts +15 -0
- package/utils/defaultBannedStrings.js +19 -0
- package/utils/defaultBannedStrings.js.map +1 -0
- package/utils/getLintConfig.d.ts +2 -0
- package/utils/getLintConfig.js +3 -0
- package/utils/getLintConfig.js.map +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/index.js.map +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
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
|
-
|
|
11
|
+
_Note:_ The SASjs project and its repositories are not affiliated with SAS Institute.
|
|
12
12
|
|
|
13
13
|
# Linting
|
|
14
14
|
|
|
@@ -22,6 +22,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are
|
|
|
22
22
|
```json
|
|
23
23
|
{
|
|
24
24
|
"allowedGremlins": [],
|
|
25
|
+
"bannedStrings": ["error ", "error:", "warning ", "warning:"],
|
|
25
26
|
"defaultHeader": "/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding}{lineEnding} <h4> SAS Macros </h4>{lineEnding}{lineEnding}**/",
|
|
26
27
|
"hasDoxygenHeader": true,
|
|
27
28
|
"hasMacroNameInMend": true,
|
|
@@ -36,6 +37,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are
|
|
|
36
37
|
"maxDataLineLength": 80,
|
|
37
38
|
"maxHeaderLineLength": 80,
|
|
38
39
|
"maxLineLength": 80,
|
|
40
|
+
"noBannedStrings": true,
|
|
39
41
|
"noEncodedPasswords": true,
|
|
40
42
|
"noGremlins": true,
|
|
41
43
|
"noNestedCommentsInHeader": true,
|
|
@@ -65,7 +67,7 @@ Each setting can have three states:
|
|
|
65
67
|
|
|
66
68
|
For more details, and the default state, see the description of each rule below. It is also possible to change whether a rule returns ERROR or WARN using the `severityLevel` object.
|
|
67
69
|
|
|
68
|
-
Configuring a non-zero return code (ERROR) is helpful when running `sasjs lint` as part of a git pre-commit hook.
|
|
70
|
+
Configuring a non-zero return code (ERROR) is helpful when running `sasjs lint` as part of a git pre-commit hook. An example is available [here](https://github.com/sasjs/template_jobs/blob/main/.git-hooks/pre-commit).
|
|
69
71
|
|
|
70
72
|
## Per-file overrides
|
|
71
73
|
|
|
@@ -92,7 +94,7 @@ One exception: `ignoreList` is evaluated before a file is read, so an entry a he
|
|
|
92
94
|
|
|
93
95
|
### allowedGremlins
|
|
94
96
|
|
|
95
|
-
An array of hex codes that represents allowed gremlins (invisible / undesirable characters). To allow all gremlins, you can also set the `noGremlins` rule to `false`.
|
|
97
|
+
An array of hex codes that represents allowed gremlins (invisible / undesirable characters). To allow all gremlins, you can also set the `noGremlins` rule to `false`. The full gremlin list is [here](https://github.com/sasjs/lint/blob/main/src/utils/gremlinCharacters.ts).
|
|
96
98
|
|
|
97
99
|
Example:
|
|
98
100
|
|
|
@@ -103,6 +105,21 @@ Example:
|
|
|
103
105
|
}
|
|
104
106
|
```
|
|
105
107
|
|
|
108
|
+
### bannedStrings
|
|
109
|
+
|
|
110
|
+
An array of strings for the [`noBannedStrings`](#nobannedstrings) rule to report. Matching is case insensitive, and each entry is matched literally rather than as a regular expression, so a trailing space means what it says: `"error "` matches `error ` but not `errors`, `error_flag` or `error:`. Each default entry ends the word with the space or the colon that follows it in a log line.
|
|
111
|
+
|
|
112
|
+
The default list is `["error ", "error:", "warning ", "warning:"]`. An explicit list replaces it, so `"bannedStrings": []` reports nothing.
|
|
113
|
+
|
|
114
|
+
Example:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"noBannedStrings": true,
|
|
119
|
+
"bannedStrings": ["error ", "error:", "warning ", "warning:", "{sas001}"]
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
106
123
|
### defaultHeader
|
|
107
124
|
|
|
108
125
|
This isn't a rule, but a formatting setting, which applies to SAS program that do NOT begin with `/**`. It can be triggered by running `sasjs lint fix` in the SASjs CLI, or by hitting "save" when using the SASjs VS Code extension (with "formatOnSave" in place)
|
|
@@ -168,6 +185,7 @@ This will require macros to have the options listed as "requiredMacroOptions." T
|
|
|
168
185
|
- severity: WARNING
|
|
169
186
|
|
|
170
187
|
Example
|
|
188
|
+
|
|
171
189
|
```json
|
|
172
190
|
{
|
|
173
191
|
"hasRequiredMacroOptions": true,
|
|
@@ -297,6 +315,29 @@ See also:
|
|
|
297
315
|
- [maxDataLineLength](#maxdatalinelength)
|
|
298
316
|
- [maxHeaderLineLength](#maxheaderlinelength)
|
|
299
317
|
|
|
318
|
+
### noBannedStrings
|
|
319
|
+
|
|
320
|
+
Reports every line that contains one of the strings in [`bannedStrings`](#bannedstrings), anywhere in the line - in a comment, in a string literal, or in code, because the text is read the way a person or a log scanner reads it rather than as SAS tokens.
|
|
321
|
+
|
|
322
|
+
The point is the log. A comment such as `/* returns the error message as text */` contains `error `, and so does a real `ERROR:` line, so a grep of the SAS log - and any log scanner built on one, including the checks people run before they look at a job - returns the comment along with the failure. The same applies to a `%put` that copies a sentence out of the documentation. Keeping those words out of the source means a match in the log is a message that came from somewhere real.
|
|
323
|
+
|
|
324
|
+
Three boundaries are deliberate. The line that carries a `@sasjslint` override is configuration rather than prose, so a file that adds a banned string does not report its own setting. Source data is left alone: a `datalines` payload may hold the text `error ` in a value, and that is data rather than something a developer can reword. And matching is case insensitive, so `Error`, `ERROR` and `error` are the same banned string; the diagnostic quotes the text as written. There is no setting to make it case sensitive: the words being caught are log lookalikes, and the log does not preserve the case an author typed either.
|
|
325
|
+
|
|
326
|
+
The entry is matched as text, so it is not anchored to a word boundary. `saserror = 1` therefore satisfies `"error "`, because the identifier ends with the word and the space before the `=` is the trailing space the entry asks for. Listing `"error "` is what keeps `errors` and `error_flag` out, and every default entry is written the same way for that reason.
|
|
327
|
+
|
|
328
|
+
The rule is a warning by default. A single file can switch it off or downgrade it with a `@sasjslint` block in its header, which is the usual way to keep a legacy program out of scope:
|
|
329
|
+
|
|
330
|
+
```sas
|
|
331
|
+
/**
|
|
332
|
+
@file
|
|
333
|
+
@brief Legacy job, comments left as written
|
|
334
|
+
@sasjslint {"noBannedStrings": false}
|
|
335
|
+
**/
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
- Default: true
|
|
339
|
+
- Severity: WARNING
|
|
340
|
+
|
|
300
341
|
### noEncodedPasswords
|
|
301
342
|
|
|
302
343
|
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.
|
|
@@ -509,13 +550,14 @@ Contact [Allan Bowe](https://www.linkedin.com/in/allanbowe/) for further details
|
|
|
509
550
|
|
|
510
551
|
# Further resources
|
|
511
552
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
553
|
+
- Using the linter on terminal: https://vid.4gl.io/w/vmJspCjcBoc5QtzwZkZRvi
|
|
554
|
+
- Longer intro to sasjs lint: https://vid.4gl.io/w/nDtkQFV1E8rtaa2BuM6U5s
|
|
555
|
+
- CLI docs: https://cli.sasjs.io/lint
|
|
515
556
|
|
|
516
557
|
# Contributors ✨
|
|
517
558
|
|
|
518
559
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
560
|
+
|
|
519
561
|
[](#contributors-)
|
|
520
562
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
521
563
|
|
package/package.json
CHANGED
package/rules/line/index.d.ts
CHANGED
package/rules/line/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noTrailingSpaces = exports.noTabs = exports.noEncodedPasswords = exports.maxLineLength = exports.indentationMultiple = exports.noGremlins = void 0;
|
|
3
|
+
exports.noTrailingSpaces = exports.noTabs = exports.noEncodedPasswords = exports.maxLineLength = exports.indentationMultiple = exports.noGremlins = exports.noBannedStrings = void 0;
|
|
4
|
+
var noBannedStrings_1 = require("./noBannedStrings");
|
|
5
|
+
Object.defineProperty(exports, "noBannedStrings", { enumerable: true, get: function () { return noBannedStrings_1.noBannedStrings; } });
|
|
4
6
|
var noGremlins_1 = require("./noGremlins");
|
|
5
7
|
Object.defineProperty(exports, "noGremlins", { enumerable: true, get: function () { return noGremlins_1.noGremlins; } });
|
|
6
8
|
var indentationMultiple_1 = require("./indentationMultiple");
|
package/rules/line/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/line/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAC3B,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/line/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAC3B,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noBannedStrings = void 0;
|
|
4
|
+
const LintRuleType_1 = require("../../types/LintRuleType");
|
|
5
|
+
const Severity_1 = require("../../types/Severity");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const name = 'noBannedStrings';
|
|
8
|
+
const description = 'Disallow configured strings, such as words that look like log messages';
|
|
9
|
+
const message = 'Line contains a banned string';
|
|
10
|
+
/**
|
|
11
|
+
* Escapes a configured string so that it is matched literally. The list is
|
|
12
|
+
* user supplied, so `{sas001}`, `(c)` and `[x]` have to survive the trip
|
|
13
|
+
* through the RegExp constructor.
|
|
14
|
+
*/
|
|
15
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
16
|
+
/**
|
|
17
|
+
* The line that carries a per-file override is configuration rather than prose.
|
|
18
|
+
* A file that adds a banned string writes that string in the override, so
|
|
19
|
+
* without this the rule reports its own configuration.
|
|
20
|
+
*/
|
|
21
|
+
const overrideLine = /^[^\w]*@sasjslint\s*\{/;
|
|
22
|
+
const test = (value, lineNumber, config, options) => {
|
|
23
|
+
const diagnostics = [];
|
|
24
|
+
// Source data is data, not code: a `datalines` payload may legitimately hold
|
|
25
|
+
// the text `error ` in a value, and it is not something a developer can edit
|
|
26
|
+
// away without changing the data.
|
|
27
|
+
if (options === null || options === void 0 ? void 0 : options.isDataLine)
|
|
28
|
+
return diagnostics;
|
|
29
|
+
if (overrideLine.test(value))
|
|
30
|
+
return diagnostics;
|
|
31
|
+
const severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || Severity_1.Severity.Warning;
|
|
32
|
+
const bannedStrings = (config === null || config === void 0 ? void 0 : config.bannedStrings) || utils_1.defaultBannedStrings;
|
|
33
|
+
if (!bannedStrings.length)
|
|
34
|
+
return diagnostics;
|
|
35
|
+
// Longest first, so a project that lists both `error:` and `error` reports the
|
|
36
|
+
// more specific match rather than only the prefix of it.
|
|
37
|
+
const patterns = [...bannedStrings].sort((a, b) => b.length - a.length);
|
|
38
|
+
const claimed = new Array(value.length).fill(false);
|
|
39
|
+
for (const bannedString of patterns) {
|
|
40
|
+
// `g` to find every occurrence, `i` so that `Error`, `ERROR` and `error` are
|
|
41
|
+
// the same banned string - case sensitivity is opt out, not opt in.
|
|
42
|
+
const regex = new RegExp(escapeRegExp(bannedString), 'gi');
|
|
43
|
+
let match;
|
|
44
|
+
while ((match = regex.exec(value))) {
|
|
45
|
+
const start = match.index;
|
|
46
|
+
const end = start + match[0].length;
|
|
47
|
+
// A span already reported by a longer banned string is not reported again.
|
|
48
|
+
if (claimed.slice(start, end).some(Boolean))
|
|
49
|
+
continue;
|
|
50
|
+
for (let index = start; index < end; index++)
|
|
51
|
+
claimed[index] = true;
|
|
52
|
+
diagnostics.push({
|
|
53
|
+
message: `${message}: "${match[0]}"`,
|
|
54
|
+
lineNumber,
|
|
55
|
+
startColumnNumber: start + 1,
|
|
56
|
+
endColumnNumber: end + 1,
|
|
57
|
+
severity
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return diagnostics.sort((a, b) => a.startColumnNumber - b.startColumnNumber);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Lint rule that checks a given line of text for strings configured in
|
|
65
|
+
* `bannedStrings`.
|
|
66
|
+
*/
|
|
67
|
+
exports.noBannedStrings = {
|
|
68
|
+
type: LintRuleType_1.LintRuleType.Line,
|
|
69
|
+
name,
|
|
70
|
+
description,
|
|
71
|
+
message,
|
|
72
|
+
test
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=noBannedStrings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noBannedStrings.js","sourceRoot":"","sources":["../../../src/rules/line/noBannedStrings.ts"],"names":[],"mappings":";;;AAEA,2DAAuD;AACvD,mDAA+C;AAC/C,uCAAkD;AAElD,MAAM,IAAI,GAAG,iBAAiB,CAAA;AAC9B,MAAM,WAAW,GACf,wEAAwE,CAAA;AAC1E,MAAM,OAAO,GAAG,+BAA+B,CAAA;AAE/C;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CACrC,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;AAE9C;;;;GAIG;AACH,MAAM,YAAY,GAAG,wBAAwB,CAAA;AAE7C,MAAM,IAAI,GAAG,CACX,KAAa,EACb,UAAkB,EAClB,MAAmB,EACnB,OAA6B,EAC7B,EAAE;IACF,MAAM,WAAW,GAAiB,EAAE,CAAA;IAEpC,6EAA6E;IAC7E,6EAA6E;IAC7E,kCAAkC;IAClC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU;QAAE,OAAO,WAAW,CAAA;IAC3C,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,WAAW,CAAA;IAEhD,MAAM,QAAQ,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,IAAI,CAAC,KAAI,mBAAQ,CAAC,OAAO,CAAA;IAChE,MAAM,aAAa,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,KAAI,4BAAoB,CAAA;IAEnE,IAAI,CAAC,aAAa,CAAC,MAAM;QAAE,OAAO,WAAW,CAAA;IAE7C,+EAA+E;IAC/E,yDAAyD;IACzD,MAAM,QAAQ,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CA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AAA,eAAe,GAAiB;IAC3C,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI;IACJ,WAAW;IACX,OAAO;IACP,IAAI;CACL,CAAA"}
|
package/sasjslint-schema.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"description": "The SASjs Lint Config file provides the settings for customising SAS code style in your project. A SAS file can override these settings for itself with a `@sasjslint` block in its Doxygen header.",
|
|
7
7
|
"default": {
|
|
8
8
|
"allowedGremlins": [],
|
|
9
|
+
"bannedStrings": ["error ", "error:", "warning ", "warning:"],
|
|
9
10
|
"defaultHeader": "/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding}{lineEnding} <h4> SAS Macros </h4>{lineEnding}{lineEnding}**/",
|
|
10
11
|
"hasDoxygenHeader": true,
|
|
11
12
|
"hasMacroNameInMend": true,
|
|
@@ -20,6 +21,7 @@
|
|
|
20
21
|
"maxDataLineLength": 80,
|
|
21
22
|
"maxHeaderLineLength": 80,
|
|
22
23
|
"maxLineLength": 80,
|
|
24
|
+
"noBannedStrings": true,
|
|
23
25
|
"noEncodedPasswords": true,
|
|
24
26
|
"noGremlins": true,
|
|
25
27
|
"noNestedCommentsInHeader": true,
|
|
@@ -65,6 +67,14 @@
|
|
|
65
67
|
}
|
|
66
68
|
],
|
|
67
69
|
"properties": {
|
|
70
|
+
"noBannedStrings": {
|
|
71
|
+
"$id": "#/properties/noBannedStrings",
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"title": "noBannedStrings",
|
|
74
|
+
"description": "Reports lines that contain a string listed in bannedStrings, such as a word that looks like a log message. Matching is case insensitive. Shows a warning when one is present.",
|
|
75
|
+
"default": true,
|
|
76
|
+
"examples": [true, false]
|
|
77
|
+
},
|
|
68
78
|
"noEncodedPasswords": {
|
|
69
79
|
"$id": "#/properties/noEncodedPasswords",
|
|
70
80
|
"type": "boolean",
|
|
@@ -97,6 +107,21 @@
|
|
|
97
107
|
"default": [true],
|
|
98
108
|
"examples": [true, false]
|
|
99
109
|
},
|
|
110
|
+
"bannedStrings": {
|
|
111
|
+
"$id": "#/properties/bannedStrings",
|
|
112
|
+
"type": "array",
|
|
113
|
+
"items": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"minLength": 1
|
|
116
|
+
},
|
|
117
|
+
"title": "bannedStrings",
|
|
118
|
+
"description": "An array of strings for the noBannedStrings rule to report. Matching is case insensitive, and each entry is matched literally, so a trailing space means what it says.",
|
|
119
|
+
"default": ["error ", "error:", "warning ", "warning:"],
|
|
120
|
+
"examples": [
|
|
121
|
+
["error ", "error:", "warning ", "warning:"],
|
|
122
|
+
["{sas001}", "TODO"]
|
|
123
|
+
]
|
|
124
|
+
},
|
|
100
125
|
"allowedGremlins": {
|
|
101
126
|
"$id": "#/properties/allowedGremlins",
|
|
102
127
|
"type": "array",
|
|
@@ -260,7 +285,10 @@
|
|
|
260
285
|
"title": "ignoreList",
|
|
261
286
|
"description": "An array of paths or path patterns to ignore when linting. Any files or matching patterns in the .gitignore file will also be ignored.",
|
|
262
287
|
"default": [],
|
|
263
|
-
"examples": [
|
|
288
|
+
"examples": [
|
|
289
|
+
["sasjsbuild/", "sasjsresults/"],
|
|
290
|
+
["sasjs/tests", "tmp/scratch.sas"]
|
|
291
|
+
]
|
|
264
292
|
},
|
|
265
293
|
"ignoredLibnames": {
|
|
266
294
|
"$id": "#/properties/ignoredLibnames",
|
|
@@ -313,6 +341,13 @@
|
|
|
313
341
|
}
|
|
314
342
|
],
|
|
315
343
|
"properties": {
|
|
344
|
+
"noBannedStrings": {
|
|
345
|
+
"$id": "#/properties/severityLevel/noBannedStrings",
|
|
346
|
+
"title": "noBannedStrings",
|
|
347
|
+
"type": "string",
|
|
348
|
+
"enum": ["error", "warn"],
|
|
349
|
+
"default": "warn"
|
|
350
|
+
},
|
|
316
351
|
"noEncodedPasswords": {
|
|
317
352
|
"$id": "#/properties/severityLevel/noEncodedPasswords",
|
|
318
353
|
"title": "noEncodedPasswords",
|
package/types/LintConfig.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare class LintConfig {
|
|
|
28
28
|
readonly requiredMacroOptions: string[];
|
|
29
29
|
readonly ignoredLibnames: string[];
|
|
30
30
|
readonly ignoredMacros: string[];
|
|
31
|
+
readonly bannedStrings: string[];
|
|
31
32
|
constructor(json?: any);
|
|
32
33
|
/**
|
|
33
34
|
* Returns a new configuration with an override merged over this one, so a
|
package/types/LintConfig.js
CHANGED
|
@@ -32,6 +32,7 @@ class LintConfig {
|
|
|
32
32
|
this.requiredMacroOptions = [];
|
|
33
33
|
this.ignoredLibnames = [];
|
|
34
34
|
this.ignoredMacros = [];
|
|
35
|
+
this.bannedStrings = [];
|
|
35
36
|
this.source = json !== null && json !== void 0 ? json : {};
|
|
36
37
|
if (json === null || json === void 0 ? void 0 : json.ignoreList) {
|
|
37
38
|
if (Array.isArray(json.ignoreList)) {
|
|
@@ -70,6 +71,28 @@ class LintConfig {
|
|
|
70
71
|
if ((json === null || json === void 0 ? void 0 : json.noEncodedPasswords) !== false) {
|
|
71
72
|
this.lineLintRules.push(line_1.noEncodedPasswords);
|
|
72
73
|
}
|
|
74
|
+
// The default list is seeded only when the setting is absent, so an empty
|
|
75
|
+
// array is an explicit "report nothing" rather than a fallback to the
|
|
76
|
+
// defaults - the same contract `ignoredMacros` follows.
|
|
77
|
+
if ((json === null || json === void 0 ? void 0 : json.bannedStrings) === undefined) {
|
|
78
|
+
this.bannedStrings.push(...utils_1.defaultBannedStrings);
|
|
79
|
+
}
|
|
80
|
+
else if (!Array.isArray(json.bannedStrings)) {
|
|
81
|
+
throw new Error(`Property "bannedStrings" can only be an array of strings.`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
json.bannedStrings.forEach((item) => {
|
|
85
|
+
if (typeof item === 'string' && item.length) {
|
|
86
|
+
this.bannedStrings.push(item);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
throw new Error(`Property "bannedStrings" has invalid type of values. It can contain only non-empty strings.`);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if ((json === null || json === void 0 ? void 0 : json.noBannedStrings) !== false) {
|
|
94
|
+
this.lineLintRules.push(line_1.noBannedStrings);
|
|
95
|
+
}
|
|
73
96
|
this.lineLintRules.push(line_1.noTabs);
|
|
74
97
|
if ((json === null || json === void 0 ? void 0 : json.noTabs) === false || (json === null || json === void 0 ? void 0 : json.noTabIndentation) === false) {
|
|
75
98
|
this.lineLintRules.pop();
|
|
@@ -213,6 +236,9 @@ class LintConfig {
|
|
|
213
236
|
if (source.ignoredMacros === undefined) {
|
|
214
237
|
source.ignoredMacros = [...this.ignoredMacros];
|
|
215
238
|
}
|
|
239
|
+
if (source.bannedStrings === undefined) {
|
|
240
|
+
source.bannedStrings = [...this.bannedStrings];
|
|
241
|
+
}
|
|
216
242
|
return new LintConfig((0, mergeLintConfig_1.mergeLintConfig)(source, json));
|
|
217
243
|
}
|
|
218
244
|
}
|
package/types/LintConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LintConfig.js","sourceRoot":"","sources":["../../src/types/LintConfig.ts"],"names":[],"mappings":";;;AAAA,wCAasB;AACtB,
|
|
1
|
+
{"version":3,"file":"LintConfig.js","sourceRoot":"","sources":["../../src/types/LintConfig.ts"],"names":[],"mappings":";;;AAAA,wCAasB;AACtB,wCAQsB;AACtB,wCAAuE;AACvE,+CAA2C;AAE3C,oCAIiB;AACjB,8DAA0D;AAC1D,yCAAqC;AAErC;;;;;;GAMG;AACH,MAAa,UAAU;IAoBrB,YAAY,IAAU;QAjBb,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,E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AAK,MAAM;oBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,mBAAQ,CAAC,OAAO,CAAA;gBACpE,IAAI,QAAQ,KAAK,OAAO;oBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,mBAAQ,CAAC,KAAK,CAAA;YACrE,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAS;QAChB,MAAM,MAAM,qBAAQ,IAAI,CAAC,MAAM,CAAE,CAAA;QAEjC,wEAAwE;QACxE,0EAA0E;QAC1E,4EAA4E;QAC5E,iEAAiE;QACjE,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,CAAC,aAAa,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAA;QAChD,CAAC;QAED,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,CAAC,aAAa,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAA;QAChD,CAAC;QAED,OAAO,IAAI,UAAU,CAAC,IAAA,iCAAe,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;IACtD,CAAC;CACF;AAxRD,gCAwRC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The strings reported by `noBannedStrings` when a project does not configure
|
|
3
|
+
* its own list.
|
|
4
|
+
*
|
|
5
|
+
* These are words that look like a log message. A comment or a `%put` that
|
|
6
|
+
* holds one turns up in a grep of the SAS log, and in any log scanner built on
|
|
7
|
+
* one, so a real problem is easy to lose among the matches that were only
|
|
8
|
+
* prose.
|
|
9
|
+
*
|
|
10
|
+
* Each entry ends a word: `error ` and `error:` carry the space or the colon
|
|
11
|
+
* that follows the word in a log line. A bare `error` would also match
|
|
12
|
+
* `error_flag`, `errors` and `saserror`, which are ordinary identifiers rather
|
|
13
|
+
* than log lookalikes, so the list is built from the delimited forms.
|
|
14
|
+
*/
|
|
15
|
+
export declare const defaultBannedStrings: string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultBannedStrings = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The strings reported by `noBannedStrings` when a project does not configure
|
|
6
|
+
* its own list.
|
|
7
|
+
*
|
|
8
|
+
* These are words that look like a log message. A comment or a `%put` that
|
|
9
|
+
* holds one turns up in a grep of the SAS log, and in any log scanner built on
|
|
10
|
+
* one, so a real problem is easy to lose among the matches that were only
|
|
11
|
+
* prose.
|
|
12
|
+
*
|
|
13
|
+
* Each entry ends a word: `error ` and `error:` carry the space or the colon
|
|
14
|
+
* that follows the word in a log line. A bare `error` would also match
|
|
15
|
+
* `error_flag`, `errors` and `saserror`, which are ordinary identifiers rather
|
|
16
|
+
* than log lookalikes, so the list is built from the delimited forms.
|
|
17
|
+
*/
|
|
18
|
+
exports.defaultBannedStrings = ['error ', 'error:', 'warning ', 'warning:'];
|
|
19
|
+
//# sourceMappingURL=defaultBannedStrings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultBannedStrings.js","sourceRoot":"","sources":["../../src/utils/defaultBannedStrings.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACU,QAAA,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA"}
|
package/utils/getLintConfig.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const getDefaultHeader: () => string;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const DefaultLintConfiguration: {
|
|
13
13
|
allowedGremlins: never[];
|
|
14
|
+
bannedStrings: string[];
|
|
14
15
|
defaultHeader: string;
|
|
15
16
|
hasDoxygenHeader: boolean;
|
|
16
17
|
hasMacroNameInMend: boolean;
|
|
@@ -25,6 +26,7 @@ export declare const DefaultLintConfiguration: {
|
|
|
25
26
|
maxDataLineLength: number;
|
|
26
27
|
maxHeaderLineLength: number;
|
|
27
28
|
maxLineLength: number;
|
|
29
|
+
noBannedStrings: boolean;
|
|
28
30
|
noEncodedPasswords: boolean;
|
|
29
31
|
noGremlins: boolean;
|
|
30
32
|
noNestedCommentsInHeader: boolean;
|
package/utils/getLintConfig.js
CHANGED
|
@@ -20,6 +20,7 @@ const LintConfig_1 = require("../types/LintConfig");
|
|
|
20
20
|
const file_1 = require("@sasjs/utils/file");
|
|
21
21
|
const getProjectRoot_1 = require("./getProjectRoot");
|
|
22
22
|
const LineEndings_1 = require("../types/LineEndings");
|
|
23
|
+
const defaultBannedStrings_1 = require("./defaultBannedStrings");
|
|
23
24
|
const defaultIgnoredMacros_1 = require("./defaultIgnoredMacros");
|
|
24
25
|
const getDefaultHeader = () => `/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding}{lineEnding} <h4> SAS Macros </h4>{lineEnding}{lineEnding}**/`;
|
|
25
26
|
exports.getDefaultHeader = getDefaultHeader;
|
|
@@ -33,6 +34,7 @@ exports.getDefaultHeader = getDefaultHeader;
|
|
|
33
34
|
*/
|
|
34
35
|
exports.DefaultLintConfiguration = {
|
|
35
36
|
allowedGremlins: [],
|
|
37
|
+
bannedStrings: [...defaultBannedStrings_1.defaultBannedStrings],
|
|
36
38
|
defaultHeader: (0, exports.getDefaultHeader)(),
|
|
37
39
|
hasDoxygenHeader: true,
|
|
38
40
|
hasMacroNameInMend: true,
|
|
@@ -47,6 +49,7 @@ exports.DefaultLintConfiguration = {
|
|
|
47
49
|
maxDataLineLength: 80,
|
|
48
50
|
maxHeaderLineLength: 80,
|
|
49
51
|
maxLineLength: 80,
|
|
52
|
+
noBannedStrings: true,
|
|
50
53
|
noEncodedPasswords: true,
|
|
51
54
|
noGremlins: true,
|
|
52
55
|
noNestedCommentsInHeader: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLintConfig.js","sourceRoot":"","sources":["../../src/utils/getLintConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getLintConfig.js","sourceRoot":"","sources":["../../src/utils/getLintConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA2DA,sCASC;AApED,gDAAuB;AACvB,4CAAmB;AACnB,oDAAgD;AAChD,4CAA4C;AAC5C,qDAAiD;AACjD,sDAAkD;AAClD,iEAA6D;AAC7D,iEAA6D;AAEtD,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,wIAAwI,CAAA;AAD7H,QAAA,gBAAgB,oBAC6G;AAE1I;;;;;;;GAOG;AACU,QAAA,wBAAwB,GAAG;IACtC,eAAe,EAAE,EAAE;IACnB,aAAa,EAAE,CAAC,GAAG,2CAAoB,CAAC;IACxC,aAAa,EAAE,IAAA,wBAAgB,GAAE;IACjC,gBAAgB,EAAE,IAAI;IACtB,kBAAkB,EAAE,IAAI;IACxB,mBAAmB,EAAE,IAAI;IACzB,uBAAuB,EAAE,KAAK;IAC9B,UAAU,EAAE,EAAE;IACd,eAAe,EAAE,EAAE;IACnB,aAAa,EAAE,CAAC,GAAG,2CAAoB,CAAC;IACxC,mBAAmB,EAAE,CAAC;IACtB,WAAW,EAAE,yBAAW,CAAC,GAAG;IAC5B,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,EAAE;IACvB,aAAa,EAAE,EAAE;IACjB,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,IAAI;IACxB,UAAU,EAAE,IAAI;IAChB,wBAAwB,EAAE,IAAI;IAC9B,cAAc,EAAE,IAAI;IACpB,wBAAwB,EAAE,KAAK;IAC/B,mBAAmB,EAAE,IAAI;IACzB,MAAM,EAAE,IAAI;IACZ,gBAAgB,EAAE,IAAI;IACtB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,KAAK;IACvB,cAAc,EAAE,IAAI;IACpB,oBAAoB,EAAE,EAAE;IACxB,aAAa,EAAE,EAAE;IACjB,qBAAqB,EAAE,IAAI;CAC5B,CAAA;AAED;;;;GAIG;AACH,SAAsB,aAAa;;QACjC,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAc,GAAE,CAAA;QAC1C,MAAM,gBAAgB,GAAG,WAAW,IAAI,YAAE,CAAC,OAAO,EAAE,CAAA;QACpD,MAAM,aAAa,GAAG,MAAM,IAAA,eAAQ,EAClC,cAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAC1C,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACZ,OAAO,IAAI,CAAC,SAAS,CAAC,gCAAwB,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,uBAAU,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAA;IAClD,CAAC;CAAA"}
|
package/utils/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './splitLines';
|
|
|
10
10
|
export * from './getIndicesOf';
|
|
11
11
|
export * from './getHeaderLinesCount';
|
|
12
12
|
export * from './getDataSectionsDetail';
|
|
13
|
+
export * from './defaultBannedStrings';
|
|
13
14
|
export * from './defaultIgnoredMacros';
|
|
14
15
|
export * from './headerMacros';
|
|
15
16
|
export * from './mergeLintConfig';
|
package/utils/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __exportStar(require("./splitLines"), exports);
|
|
|
26
26
|
__exportStar(require("./getIndicesOf"), exports);
|
|
27
27
|
__exportStar(require("./getHeaderLinesCount"), exports);
|
|
28
28
|
__exportStar(require("./getDataSectionsDetail"), exports);
|
|
29
|
+
__exportStar(require("./defaultBannedStrings"), exports);
|
|
29
30
|
__exportStar(require("./defaultIgnoredMacros"), exports);
|
|
30
31
|
__exportStar(require("./headerMacros"), exports);
|
|
31
32
|
__exportStar(require("./mergeLintConfig"), exports);
|
package/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,sDAAmC;AACnC,8CAA2B;AAC3B,iDAA8B;AAC9B,8CAA2B;AAC3B,gDAA6B;AAC7B,+CAA4B;AAC5B,iDAA8B;AAC9B,wDAAqC;AACrC,0DAAuC;AACvC,yDAAsC;AACtC,iDAA8B;AAC9B,oDAAiC;AACjC,kDAA+B;AAC/B,sDAAmC;AACnC,oDAAiC;AACjC,8CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,sDAAmC;AACnC,8CAA2B;AAC3B,iDAA8B;AAC9B,8CAA2B;AAC3B,gDAA6B;AAC7B,+CAA4B;AAC5B,iDAA8B;AAC9B,wDAAqC;AACrC,0DAAuC;AACvC,yDAAsC;AACtC,yDAAsC;AACtC,iDAA8B;AAC9B,oDAAiC;AACjC,kDAA+B;AAC/B,sDAAmC;AACnC,oDAAiC;AACjC,8CAA2B"}
|