@sasjs/lint 1.15.0 → 2.0.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/README.md +105 -94
- package/package.json +1 -1
- package/rules/line/index.d.ts +1 -1
- package/rules/line/index.js +3 -3
- package/rules/line/index.js.map +1 -1
- package/rules/line/{noTabIndentation.d.ts → noTabs.d.ts} +1 -1
- package/rules/line/noTabs.js +34 -0
- package/rules/line/noTabs.js.map +1 -0
- package/sasjslint-schema.json +23 -20
- package/types/LintConfig.js +2 -2
- package/types/LintConfig.js.map +1 -1
- package/utils/getIndicesOf.d.ts +1 -0
- package/utils/getIndicesOf.js +22 -0
- package/utils/getIndicesOf.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/index.js.map +1 -1
- package/rules/line/noTabIndentation.js +0 -33
- package/rules/line/noTabIndentation.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,48 +9,46 @@
|
|
|
9
9
|
|
|
10
10
|
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.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
# Linting
|
|
13
|
+
|
|
13
14
|
@sasjs/lint is used by the following products:
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
- [@sasjs/vscode-extension](https://github.com/sasjs/vscode-extension) - just download SASjs in the VSCode marketplace, and select view/problems in the menu bar.
|
|
17
|
+
- [@sasjs/cli](https://cli.sasjs.io/lint) - run `sasjs lint` to get a list of all files with their problems, along with line and column indexes.
|
|
17
18
|
|
|
18
19
|
Configuration is via a `.sasjslint` file with the following structure (these are also the defaults if no .sasjslint file is found):
|
|
19
20
|
|
|
20
21
|
```json
|
|
21
22
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"noTabIndentation": true,
|
|
36
|
-
"noTrailingSpaces": true,
|
|
37
|
-
"defaultHeader": "/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding} <h4> SAS Macros </h4>{lineEnding}**/"
|
|
23
|
+
"noEncodedPasswords": true,
|
|
24
|
+
"hasDoxygenHeader": true,
|
|
25
|
+
"hasMacroNameInMend": true,
|
|
26
|
+
"hasMacroParentheses": true,
|
|
27
|
+
"ignoreList": ["sajsbuild/", "sasjsresults/"],
|
|
28
|
+
"indentationMultiple": 2,
|
|
29
|
+
"lowerCaseFileNames": true,
|
|
30
|
+
"maxLineLength": 80,
|
|
31
|
+
"noNestedMacros": true,
|
|
32
|
+
"noSpacesInFileNames": true,
|
|
33
|
+
"noTabs": true,
|
|
34
|
+
"noTrailingSpaces": true,
|
|
35
|
+
"defaultHeader": "/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding} <h4> SAS Macros </h4>{lineEnding}**/"
|
|
38
36
|
}
|
|
39
37
|
```
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
## SAS Lint Settings
|
|
42
40
|
|
|
43
41
|
Each setting can have three states:
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
- OFF - usually by setting the value to `false` or 0. In this case, the rule won't be executed.
|
|
44
|
+
- WARN - a warning is written to the log, but the return code will be 0
|
|
45
|
+
- ERROR - an error is written to the log, and the return code is 1
|
|
48
46
|
|
|
49
|
-
For more details, and the default state, see the description of each rule below.
|
|
47
|
+
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 `severityLevels` object.
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
### defaultHeader
|
|
52
50
|
|
|
53
|
-
This isn't actually a rule - but rather a formatting setting, which applies to SAS program that do NOT begin with `/**`.
|
|
51
|
+
This isn't actually a rule - but rather 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)
|
|
54
52
|
|
|
55
53
|
The default header is as follows:
|
|
56
54
|
|
|
@@ -61,6 +59,7 @@ The default header is as follows:
|
|
|
61
59
|
<h4> SAS Macros </h4>
|
|
62
60
|
**/
|
|
63
61
|
```
|
|
62
|
+
|
|
64
63
|
If creating a new value, use `{lineEnding}` instead of `\n`, eg as follows:
|
|
65
64
|
|
|
66
65
|
```json
|
|
@@ -69,88 +68,100 @@ If creating a new value, use `{lineEnding}` instead of `\n`, eg as follows:
|
|
|
69
68
|
}
|
|
70
69
|
```
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
### noEncodedPasswords
|
|
72
|
+
|
|
73
|
+
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.
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
- Default: true
|
|
76
|
+
- Severity: ERROR
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
* Severity: ERROR
|
|
78
|
+
### hasDoxygenHeader
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
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.
|
|
80
|
+
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.
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
- Default: true
|
|
83
|
+
- Severity: WARNING
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
The addition of the macro name in the `%mend` statement is optional, but can approve readability in large programs. A discussion on this topic can be found [here](https://www.linkedin.com/posts/allanbowe_sas-sasapps-sasjs-activity-6783413360781266945-1-7m). The default setting was the result of a poll with over 300 votes.
|
|
85
|
+
### hasMacroNameInMend
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
* Severity: WARNING
|
|
87
|
+
The addition of the macro name in the `%mend` statement is optional, but can approve readability in large programs. A discussion on this topic can be found [here](https://www.linkedin.com/posts/allanbowe_sas-sasapps-sasjs-activity-6783413360781266945-1-7m). The default setting was the result of a poll with over 300 votes.
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
- Default: true
|
|
90
|
+
- Severity: WARNING
|
|
93
91
|
|
|
94
|
-
|
|
95
|
-
* Severity: WARNING
|
|
92
|
+
### hasMacroParentheses
|
|
96
93
|
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
As per the example [here](https://github.com/sasjs/lint/issues/20), macros defined without parentheses cause problems if that macro is ever extended (it's not possible to reliably extend that macro without potentially breaking some code that has used the macro). It's better to always define parentheses, even if they are not used. This check will also throw a warning if there are spaces between the macro name and the opening parenthesis.
|
|
95
|
+
|
|
96
|
+
- Default: true
|
|
97
|
+
- Severity: WARNING
|
|
98
|
+
|
|
99
|
+
### ignoreList
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
### indentationMultiple
|
|
99
104
|
|
|
100
|
-
#### indentationMultiple
|
|
101
105
|
This will check each line to ensure that the count of leading spaces can be divided cleanly by this multiple.
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
- Default: 2
|
|
108
|
+
- Severity: WARNING
|
|
109
|
+
|
|
110
|
+
### lowerCaseFileNames
|
|
105
111
|
|
|
106
|
-
|
|
107
|
-
On *nix systems, it is imperative that autocall macros are in lowercase. When sharing code between windows and *nix systems, the difference in case sensitivity can also be a cause of lost developer time. For this reason, we recommend that sas filenames are always lowercase.
|
|
112
|
+
On *nix systems, it is imperative that autocall macros are in lowercase. When sharing code between windows and *nix systems, the difference in case sensitivity can also be a cause of lost developer time. For this reason, we recommend that sas filenames are always lowercase.
|
|
108
113
|
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
- Default: true
|
|
115
|
+
- Severity: WARNING
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
### maxLineLength
|
|
118
|
+
|
|
119
|
+
Code becomes far more readable when line lengths are short. The most compelling reason for short line lengths is to avoid the need to scroll when performing a side-by-side 'compare' between two files (eg as part of a GIT feature branch review). A longer discussion on optimal code line length can be found [here](https://stackoverflow.com/questions/578059/studies-on-optimal-code-width)
|
|
114
120
|
|
|
115
121
|
In batch mode, long SAS code lines may also be truncated, causing hard-to-detect errors.
|
|
116
122
|
|
|
117
|
-
We strongly recommend a line length limit, and set the bar at 80.
|
|
123
|
+
We strongly recommend a line length limit, and set the bar at 80. To turn this feature off, set the value to 0.
|
|
124
|
+
|
|
125
|
+
- Default: 80
|
|
126
|
+
- Severity: WARNING
|
|
127
|
+
|
|
128
|
+
### noNestedMacros
|
|
118
129
|
|
|
119
|
-
|
|
120
|
-
* Severity: WARNING
|
|
130
|
+
Where macros are defined inside other macros, they are recompiled every time the outer macro is invoked. Hence, it is widely considered inefficient, and bad practice, to nest macro definitions.
|
|
121
131
|
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
- Default: true
|
|
133
|
+
- Severity: WARNING
|
|
124
134
|
|
|
125
|
-
|
|
126
|
-
* Severity: WARNING
|
|
135
|
+
### noSpacesInFileNames
|
|
127
136
|
|
|
128
|
-
#### noSpacesInFileNames
|
|
129
137
|
The 'beef' we have with spaces in filenames is twofold:
|
|
130
138
|
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
- Loss of the in-built ability to 'click' a filepath and have the file open automatically
|
|
140
|
+
- The need to quote such filepaths in order to use them in CLI commands
|
|
141
|
+
|
|
142
|
+
In addition, when such files are used in URLs, they are often padded with a messy "%20" type quotation. And of course, for macros (where the macro should match the filename) then spaces are simply not valid.
|
|
143
|
+
|
|
144
|
+
- Default: true
|
|
145
|
+
- Severity: WARNING
|
|
133
146
|
|
|
134
|
-
|
|
147
|
+
### noTabs
|
|
135
148
|
|
|
136
|
-
|
|
137
|
-
* Severity: WARNING
|
|
149
|
+
Whilst there are some arguments for using tabs (such as the ability to set your own indentation width, and to reduce character count) there are many, many, many developers who think otherwise. We're in that camp. Sorry (not sorry).
|
|
138
150
|
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
- Alias: noTabIndentation
|
|
152
|
+
- Default: true
|
|
153
|
+
- Severity: WARNING
|
|
141
154
|
|
|
142
|
-
|
|
143
|
-
* Severity: WARNING
|
|
155
|
+
### noTrailingSpaces
|
|
144
156
|
|
|
145
|
-
|
|
146
|
-
This will highlight lines with trailing spaces. Trailing spaces serve no useful purpose in a SAS program.
|
|
157
|
+
This will highlight lines with trailing spaces. Trailing spaces serve no useful purpose in a SAS program.
|
|
147
158
|
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
- Default: true
|
|
160
|
+
- severity: WARNING
|
|
150
161
|
|
|
151
|
-
|
|
162
|
+
## severityLevel
|
|
152
163
|
|
|
153
|
-
This setting allows the default severity to be adjusted.
|
|
164
|
+
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:
|
|
154
165
|
|
|
155
166
|
```json
|
|
156
167
|
{
|
|
@@ -165,46 +176,46 @@ This setting allows the default severity to be adjusted. This is helpful when r
|
|
|
165
176
|
}
|
|
166
177
|
```
|
|
167
178
|
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
- "warn" - show warning in the log (doesn’t affect exit code)
|
|
180
|
+
- "error" - show error in the log (exit code is 1 when triggered)
|
|
170
181
|
|
|
171
|
-
|
|
182
|
+
## Upcoming Linting Rules:
|
|
172
183
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
* `lineEndings` -> set a standard line ending, such as LF or CRLF
|
|
184
|
+
- `noGremlins` -> identifies all invisible characters, other than spaces / tabs / line endings. If you really need that bell character, use a hex literal!
|
|
185
|
+
- `lineEndings` -> set a standard line ending, such as LF or CRLF
|
|
176
186
|
|
|
177
|
-
|
|
187
|
+
# SAS Formatter
|
|
178
188
|
|
|
179
189
|
A formatter will automatically apply rules when you hit SAVE, which can save a LOT of time.
|
|
180
190
|
|
|
181
191
|
We've already implemented the following rules:
|
|
182
192
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
193
|
+
- Add the macro name to the %mend statement
|
|
194
|
+
- Add a doxygen header template if none exists
|
|
195
|
+
- Remove trailing spaces
|
|
186
196
|
|
|
187
197
|
We're looking to implement the following rules:
|
|
188
198
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
199
|
+
- Change tabs to spaces
|
|
200
|
+
- zap gremlins
|
|
201
|
+
- fix line endings
|
|
192
202
|
|
|
193
203
|
We are also investigating some harder stuff, such as automatic indentation and code layout
|
|
194
204
|
|
|
195
|
-
|
|
205
|
+
# Sponsorship & Contributions
|
|
196
206
|
|
|
197
|
-
SASjs is an open source framework!
|
|
207
|
+
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?
|
|
198
208
|
|
|
199
209
|
Contact [Allan Bowe](https://www.linkedin.com/in/allanbowe/) for further details.
|
|
200
210
|
|
|
211
|
+
# Contributors ✨
|
|
201
212
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
## Contributors ✨
|
|
205
213
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
214
|
+
|
|
206
215
|
[](#contributors-)
|
|
216
|
+
|
|
207
217
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
218
|
+
|
|
208
219
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
209
220
|
|
|
210
221
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
package/package.json
CHANGED
package/rules/line/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { indentationMultiple } from './indentationMultiple';
|
|
2
2
|
export { maxLineLength } from './maxLineLength';
|
|
3
3
|
export { noEncodedPasswords } from './noEncodedPasswords';
|
|
4
|
-
export {
|
|
4
|
+
export { noTabs } from './noTabs';
|
|
5
5
|
export { noTrailingSpaces } from './noTrailingSpaces';
|
package/rules/line/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noTrailingSpaces = exports.
|
|
3
|
+
exports.noTrailingSpaces = exports.noTabs = exports.noEncodedPasswords = exports.maxLineLength = exports.indentationMultiple = void 0;
|
|
4
4
|
var indentationMultiple_1 = require("./indentationMultiple");
|
|
5
5
|
Object.defineProperty(exports, "indentationMultiple", { enumerable: true, get: function () { return indentationMultiple_1.indentationMultiple; } });
|
|
6
6
|
var maxLineLength_1 = require("./maxLineLength");
|
|
7
7
|
Object.defineProperty(exports, "maxLineLength", { enumerable: true, get: function () { return maxLineLength_1.maxLineLength; } });
|
|
8
8
|
var noEncodedPasswords_1 = require("./noEncodedPasswords");
|
|
9
9
|
Object.defineProperty(exports, "noEncodedPasswords", { enumerable: true, get: function () { return noEncodedPasswords_1.noEncodedPasswords; } });
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var noTabs_1 = require("./noTabs");
|
|
11
|
+
Object.defineProperty(exports, "noTabs", { enumerable: true, get: function () { return noTabs_1.noTabs; } });
|
|
12
12
|
var noTrailingSpaces_1 = require("./noTrailingSpaces");
|
|
13
13
|
Object.defineProperty(exports, "noTrailingSpaces", { enumerable: true, get: function () { return noTrailingSpaces_1.noTrailingSpaces; } });
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
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,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAC3B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/line/index.ts"],"names":[],"mappings":";;;AAAA,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,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noTabs = void 0;
|
|
4
|
+
var LintRuleType_1 = require("../../types/LintRuleType");
|
|
5
|
+
var Severity_1 = require("../../types/Severity");
|
|
6
|
+
var utils_1 = require("../../utils");
|
|
7
|
+
var name = 'noTabs';
|
|
8
|
+
var alias = 'noTabIndentation';
|
|
9
|
+
var description = 'Disallow indenting with tabs.';
|
|
10
|
+
var message = 'Line contains a tab character (09x)';
|
|
11
|
+
var test = function (value, lineNumber, config) {
|
|
12
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) ||
|
|
13
|
+
(config === null || config === void 0 ? void 0 : config.severityLevel[alias]) ||
|
|
14
|
+
Severity_1.Severity.Warning;
|
|
15
|
+
var indices = utils_1.getIndicesOf('\t', value);
|
|
16
|
+
return indices.map(function (index) { return ({
|
|
17
|
+
message: message,
|
|
18
|
+
lineNumber: lineNumber,
|
|
19
|
+
startColumnNumber: index + 1,
|
|
20
|
+
endColumnNumber: index + 2,
|
|
21
|
+
severity: severity
|
|
22
|
+
}); });
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Lint rule that checks if a given line of text is indented with a tab.
|
|
26
|
+
*/
|
|
27
|
+
exports.noTabs = {
|
|
28
|
+
type: LintRuleType_1.LintRuleType.Line,
|
|
29
|
+
name: name,
|
|
30
|
+
description: description,
|
|
31
|
+
message: message,
|
|
32
|
+
test: test
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=noTabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noTabs.js","sourceRoot":"","sources":["../../../src/rules/line/noTabs.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,iDAA+C;AAC/C,qCAA0C;AAE1C,IAAM,IAAI,GAAG,QAAQ,CAAA;AACrB,IAAM,KAAK,GAAG,kBAAkB,CAAA;AAChC,IAAM,WAAW,GAAG,+BAA+B,CAAA;AACnD,IAAM,OAAO,GAAG,qCAAqC,CAAA;AAErD,IAAM,IAAI,GAAG,UAAC,KAAa,EAAE,UAAkB,EAAE,MAAmB;IAClE,IAAM,QAAQ,GACZ,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,IAAI,CAAC;SAC3B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,KAAK,CAAC,CAAA;QAC5B,mBAAQ,CAAC,OAAO,CAAA;IAElB,IAAM,OAAO,GAAG,oBAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAEzC,OAAO,OAAO,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;QAC7B,OAAO,SAAA;QACP,UAAU,YAAA;QACV,iBAAiB,EAAE,KAAK,GAAG,CAAC;QAC5B,eAAe,EAAE,KAAK,GAAG,CAAC;QAC1B,QAAQ,UAAA;KACT,CAAC,EAN4B,CAM5B,CAAC,CAAA;AACL,CAAC,CAAA;AAED;;GAEG;AACU,QAAA,MAAM,GAAiB;IAClC,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI,MAAA;IACJ,WAAW,aAAA;IACX,OAAO,SAAA;IACP,IAAI,MAAA;CACL,CAAA"}
|
package/sasjslint-schema.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"maxLineLength": 80,
|
|
16
16
|
"noNestedMacros": true,
|
|
17
17
|
"noSpacesInFileNames": true,
|
|
18
|
-
"
|
|
18
|
+
"noTabs": true,
|
|
19
19
|
"noTrailingSpaces": true,
|
|
20
20
|
"lineEndings": "lf",
|
|
21
21
|
"strictMacroDefinition": true,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"noSpacesInFileNames": true,
|
|
30
30
|
"lowerCaseFileNames": true,
|
|
31
31
|
"maxLineLength": 80,
|
|
32
|
-
"
|
|
32
|
+
"noTabs": true,
|
|
33
33
|
"indentationMultiple": 4,
|
|
34
34
|
"hasMacroNameInMend": true,
|
|
35
35
|
"noNestedMacros": true,
|
|
@@ -120,11 +120,11 @@
|
|
|
120
120
|
"default": true,
|
|
121
121
|
"examples": [true, false]
|
|
122
122
|
},
|
|
123
|
-
"
|
|
124
|
-
"$id": "#/properties/
|
|
123
|
+
"noTabs": {
|
|
124
|
+
"$id": "#/properties/noTabs",
|
|
125
125
|
"type": "boolean",
|
|
126
|
-
"title": "
|
|
127
|
-
"description": "Enforces no indentation using tabs. Shows a warning when a line
|
|
126
|
+
"title": "noTabs",
|
|
127
|
+
"description": "Enforces no indentation using tabs. Shows a warning when a line contains a tab.",
|
|
128
128
|
"default": true,
|
|
129
129
|
"examples": [true, false]
|
|
130
130
|
},
|
|
@@ -166,15 +166,18 @@
|
|
|
166
166
|
"title": "severityLevel",
|
|
167
167
|
"description": "An object which specifies the severity level of each rule.",
|
|
168
168
|
"default": {},
|
|
169
|
-
"examples": [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
169
|
+
"examples": [
|
|
170
|
+
{
|
|
171
|
+
"hasDoxygenHeader": "warn",
|
|
172
|
+
"maxLineLength": "warn",
|
|
173
|
+
"noTrailingSpaces": "error"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"hasDoxygenHeader": "warn",
|
|
177
|
+
"maxLineLength": "error",
|
|
178
|
+
"noTrailingSpaces": "error"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
178
181
|
"properties": {
|
|
179
182
|
"noEncodedPasswords": {
|
|
180
183
|
"$id": "#/properties/severityLevel/noEncodedPasswords",
|
|
@@ -188,7 +191,8 @@
|
|
|
188
191
|
"title": "hasDoxygenHeader",
|
|
189
192
|
"type": "string",
|
|
190
193
|
"enum": ["error", "warn"],
|
|
191
|
-
"default": "warn"
|
|
194
|
+
"default": "warn"
|
|
195
|
+
},
|
|
192
196
|
"hasMacroNameInMend": {
|
|
193
197
|
"$id": "#/properties/severityLevel/hasMacroNameInMend",
|
|
194
198
|
"title": "hasMacroNameInMend",
|
|
@@ -238,9 +242,9 @@
|
|
|
238
242
|
"enum": ["error", "warn"],
|
|
239
243
|
"default": "warn"
|
|
240
244
|
},
|
|
241
|
-
"
|
|
242
|
-
"$id": "#/properties/severityLevel/
|
|
243
|
-
"title": "
|
|
245
|
+
"noTabs": {
|
|
246
|
+
"$id": "#/properties/severityLevel/noTabs",
|
|
247
|
+
"title": "noTabs",
|
|
244
248
|
"type": "string",
|
|
245
249
|
"enum": ["error", "warn"],
|
|
246
250
|
"default": "warn"
|
|
@@ -267,7 +271,6 @@
|
|
|
267
271
|
"default": "warn"
|
|
268
272
|
}
|
|
269
273
|
}
|
|
270
|
-
|
|
271
274
|
}
|
|
272
275
|
}
|
|
273
276
|
}
|
package/types/LintConfig.js
CHANGED
|
@@ -73,8 +73,8 @@ var LintConfig = /** @class */ (function () {
|
|
|
73
73
|
if (json === null || json === void 0 ? void 0 : json.noEncodedPasswords) {
|
|
74
74
|
this.lineLintRules.push(line_1.noEncodedPasswords);
|
|
75
75
|
}
|
|
76
|
-
if (json === null || json === void 0 ? void 0 : json.noTabIndentation) {
|
|
77
|
-
this.lineLintRules.push(line_1.
|
|
76
|
+
if ((json === null || json === void 0 ? void 0 : json.noTabs) || (json === null || json === void 0 ? void 0 : json.noTabIndentation)) {
|
|
77
|
+
this.lineLintRules.push(line_1.noTabs);
|
|
78
78
|
}
|
|
79
79
|
if (json === null || json === void 0 ? void 0 : json.maxLineLength) {
|
|
80
80
|
this.maxLineLength = json.maxLineLength;
|
package/types/LintConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LintConfig.js","sourceRoot":"","sources":["../../src/types/LintConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAOsB;AACtB,sCAMsB;AACtB,sCAAuE;AACvE,6CAA2C;AAE3C,kCAA2C;AAC3C,uCAAqC;AAErC;;;;;;GAMG;AACH;IAWE,oBAAY,IAAU;;QAAtB,iBAwFC;QAlGQ,eAAU,GAAa,EAAE,CAAA;QACzB,kBAAa,GAAmB,EAAE,CAAA;QAClC,kBAAa,GAAmB,EAAE,CAAA;QAClC,kBAAa,GAAmB,EAAE,CAAA;QAClC,kBAAa,GAAW,EAAE,CAAA;QAC1B,wBAAmB,GAAW,CAAC,CAAA;QAC/B,gBAAW,GAAgB,yBAAW,CAAC,EAAE,CAAA;QACzC,kBAAa,GAAW,wBAAgB,EAAE,CAAA;QAC1C,kBAAa,GAAgC,EAAE,CAAA;QAGtD,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,KAAK,CAAC,yDAAuD,CAAC,CAAA;a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QAED,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,EAAE;;gBACvB,KAA+B,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA,gBAAA,4BAAE;oBAAxD,IAAA,KAAA,mBAAgB,EAAf,IAAI,QAAA,EAAE,QAAQ,QAAA;oBACxB,IAAI,QAAQ,KAAK,MAAM;wBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,mBAAQ,CAAC,OAAO,CAAA;oBACpE,IAAI,QAAQ,KAAK,OAAO;wBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,mBAAQ,CAAC,KAAK,CAAA;iBACpE;;;;;;;;;SACF;IACH,CAAC;IACH,iBAAC;AAAD,CAAC,AApGD,IAoGC;AApGY,gCAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getIndicesOf: (searchStr: string, str: string, caseSensitive?: boolean) => number[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIndicesOf = void 0;
|
|
4
|
+
var getIndicesOf = function (searchStr, str, caseSensitive) {
|
|
5
|
+
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
6
|
+
var searchStrLen = searchStr.length;
|
|
7
|
+
if (searchStrLen === 0) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
var startIndex = 0, index, indices = [];
|
|
11
|
+
if (!caseSensitive) {
|
|
12
|
+
str = str.toLowerCase();
|
|
13
|
+
searchStr = searchStr.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
while ((index = str.indexOf(searchStr, startIndex)) > -1) {
|
|
16
|
+
indices.push(index);
|
|
17
|
+
startIndex = index + searchStrLen;
|
|
18
|
+
}
|
|
19
|
+
return indices;
|
|
20
|
+
};
|
|
21
|
+
exports.getIndicesOf = getIndicesOf;
|
|
22
|
+
//# sourceMappingURL=getIndicesOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIndicesOf.js","sourceRoot":"","sources":["../../src/utils/getIndicesOf.ts"],"names":[],"mappings":";;;AAAO,IAAM,YAAY,GAAG,UAC1B,SAAiB,EACjB,GAAW,EACX,aAA6B;IAA7B,8BAAA,EAAA,oBAA6B;IAE7B,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAA;IACrC,IAAI,YAAY,KAAK,CAAC,EAAE;QACtB,OAAO,EAAE,CAAA;KACV;IAED,IAAI,UAAU,GAAG,CAAC,EAChB,KAAK,EACL,OAAO,GAAG,EAAE,CAAA;IAEd,IAAI,CAAC,aAAa,EAAE;QAClB,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;QACvB,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAA;KACpC;IAED,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;QACxD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnB,UAAU,GAAG,KAAK,GAAG,YAAY,CAAA;KAClC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAzBY,QAAA,YAAY,gBAyBxB"}
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -16,4 +16,5 @@ __exportStar(require("./getProjectRoot"), exports);
|
|
|
16
16
|
__exportStar(require("./isIgnored"), exports);
|
|
17
17
|
__exportStar(require("./listSasFiles"), exports);
|
|
18
18
|
__exportStar(require("./splitText"), exports);
|
|
19
|
+
__exportStar(require("./getIndicesOf"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
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,8CAA2B;AAC3B,iDAA8B;AAC9B,8CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,8CAA2B;AAC3B,iDAA8B;AAC9B,8CAA2B;AAC3B,iDAA8B"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noTabIndentation = void 0;
|
|
4
|
-
var LintRuleType_1 = require("../../types/LintRuleType");
|
|
5
|
-
var Severity_1 = require("../../types/Severity");
|
|
6
|
-
var name = 'noTabs';
|
|
7
|
-
var description = 'Disallow indenting with tabs.';
|
|
8
|
-
var message = 'Line is indented with a tab';
|
|
9
|
-
var test = function (value, lineNumber, config) {
|
|
10
|
-
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || Severity_1.Severity.Warning;
|
|
11
|
-
if (!value.startsWith('\t'))
|
|
12
|
-
return [];
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
message: message,
|
|
16
|
-
lineNumber: lineNumber,
|
|
17
|
-
startColumnNumber: 1,
|
|
18
|
-
endColumnNumber: 1,
|
|
19
|
-
severity: severity
|
|
20
|
-
}
|
|
21
|
-
];
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Lint rule that checks if a given line of text is indented with a tab.
|
|
25
|
-
*/
|
|
26
|
-
exports.noTabIndentation = {
|
|
27
|
-
type: LintRuleType_1.LintRuleType.Line,
|
|
28
|
-
name: name,
|
|
29
|
-
description: description,
|
|
30
|
-
message: message,
|
|
31
|
-
test: test
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=noTabIndentation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noTabIndentation.js","sourceRoot":"","sources":["../../../src/rules/line/noTabIndentation.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,iDAA+C;AAE/C,IAAM,IAAI,GAAG,QAAQ,CAAA;AACrB,IAAM,WAAW,GAAG,+BAA+B,CAAA;AACnD,IAAM,OAAO,GAAG,6BAA6B,CAAA;AAE7C,IAAM,IAAI,GAAG,UAAC,KAAa,EAAE,UAAkB,EAAE,MAAmB;IAClE,IAAM,QAAQ,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,IAAI,CAAC,KAAI,mBAAQ,CAAC,OAAO,CAAA;IAChE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAA;IACtC,OAAO;QACL;YACE,OAAO,SAAA;YACP,UAAU,YAAA;YACV,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,CAAC;YAClB,QAAQ,UAAA;SACT;KACF,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACU,QAAA,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI,MAAA;IACJ,WAAW,aAAA;IACX,OAAO,SAAA;IACP,IAAI,MAAA;CACL,CAAA"}
|