@sasjs/lint 1.14.1 → 2.0.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 +127 -87
- package/lint/shared.js +2 -2
- package/lint/shared.js.map +1 -1
- package/package.json +1 -1
- package/rules/file/hasDoxygenHeader.js +4 -3
- package/rules/file/hasDoxygenHeader.js.map +1 -1
- package/rules/file/hasMacroNameInMend.js +5 -4
- package/rules/file/hasMacroNameInMend.js.map +1 -1
- package/rules/file/hasMacroParentheses.js +3 -2
- package/rules/file/hasMacroParentheses.js.map +1 -1
- package/rules/file/lineEndings.js +3 -2
- package/rules/file/lineEndings.js.map +1 -1
- package/rules/file/noNestedMacros.js +2 -1
- package/rules/file/noNestedMacros.js.map +1 -1
- package/rules/file/strictMacroDefinition.js +8 -6
- package/rules/file/strictMacroDefinition.js.map +1 -1
- package/rules/line/indentationMultiple.js +2 -1
- package/rules/line/indentationMultiple.js.map +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/maxLineLength.js +2 -1
- package/rules/line/maxLineLength.js.map +1 -1
- package/rules/line/noEncodedPasswords.js +3 -2
- package/rules/line/noEncodedPasswords.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/rules/line/noTrailingSpaces.js +3 -2
- package/rules/line/noTrailingSpaces.js.map +1 -1
- package/rules/path/lowerCaseFileNames.js +3 -2
- package/rules/path/lowerCaseFileNames.js.map +1 -1
- package/rules/path/noSpacesInFileNames.js +3 -2
- package/rules/path/noSpacesInFileNames.js.map +1 -1
- package/sasjslint-schema.json +118 -6
- package/types/LintConfig.d.ts +4 -0
- package/types/LintConfig.js +50 -2
- package/types/LintConfig.js.map +1 -1
- package/types/LintRule.d.ts +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 -32
- package/rules/line/noTabIndentation.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,40 +9,48 @@
|
|
|
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
|
|
40
|
+
|
|
41
|
+
Each setting can have three states:
|
|
42
|
+
|
|
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
|
|
46
|
+
|
|
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.
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
### defaultHeader
|
|
44
50
|
|
|
45
|
-
This
|
|
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)
|
|
52
|
+
|
|
53
|
+
The default header is as follows:
|
|
46
54
|
|
|
47
55
|
```sas
|
|
48
56
|
/**
|
|
@@ -52,7 +60,7 @@ This sets the default program header - applies when a SAS program does NOT begin
|
|
|
52
60
|
**/
|
|
53
61
|
```
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
If creating a new value, use `{lineEnding}` instead of `\n`, eg as follows:
|
|
56
64
|
|
|
57
65
|
```json
|
|
58
66
|
{
|
|
@@ -60,122 +68,154 @@ The default header is automatically applied when running `sasjs lint fix` in the
|
|
|
60
68
|
}
|
|
61
69
|
```
|
|
62
70
|
|
|
63
|
-
|
|
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.
|
|
74
|
+
|
|
75
|
+
- Default: true
|
|
76
|
+
- Severity: ERROR
|
|
77
|
+
|
|
78
|
+
### hasDoxygenHeader
|
|
64
79
|
|
|
65
|
-
|
|
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.
|
|
66
81
|
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
- Default: true
|
|
83
|
+
- Severity: WARNING
|
|
69
84
|
|
|
70
|
-
|
|
71
|
-
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.
|
|
85
|
+
### hasMacroNameInMend
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
* 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.
|
|
75
88
|
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
- Default: true
|
|
90
|
+
- Severity: WARNING
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
* Severity: WARNING
|
|
92
|
+
### hasMacroParentheses
|
|
81
93
|
|
|
82
|
-
|
|
83
|
-
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.
|
|
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.
|
|
84
95
|
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
- Default: true
|
|
97
|
+
- Severity: WARNING
|
|
87
98
|
|
|
88
|
-
|
|
89
|
-
|
|
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
|
|
90
104
|
|
|
91
|
-
#### indentationMultiple
|
|
92
105
|
This will check each line to ensure that the count of leading spaces can be divided cleanly by this multiple.
|
|
93
106
|
|
|
94
|
-
|
|
95
|
-
|
|
107
|
+
- Default: 2
|
|
108
|
+
- Severity: WARNING
|
|
109
|
+
|
|
110
|
+
### lowerCaseFileNames
|
|
111
|
+
|
|
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.
|
|
96
113
|
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
- Default: true
|
|
115
|
+
- Severity: WARNING
|
|
99
116
|
|
|
100
|
-
|
|
101
|
-
* Severity: WARNING
|
|
117
|
+
### maxLineLength
|
|
102
118
|
|
|
103
|
-
|
|
104
|
-
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)
|
|
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)
|
|
105
120
|
|
|
106
121
|
In batch mode, long SAS code lines may also be truncated, causing hard-to-detect errors.
|
|
107
122
|
|
|
108
|
-
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.
|
|
109
124
|
|
|
110
|
-
|
|
111
|
-
|
|
125
|
+
- Default: 80
|
|
126
|
+
- Severity: WARNING
|
|
112
127
|
|
|
113
|
-
|
|
114
|
-
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.
|
|
128
|
+
### noNestedMacros
|
|
115
129
|
|
|
116
|
-
|
|
117
|
-
|
|
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.
|
|
131
|
+
|
|
132
|
+
- Default: true
|
|
133
|
+
- Severity: WARNING
|
|
134
|
+
|
|
135
|
+
### noSpacesInFileNames
|
|
118
136
|
|
|
119
|
-
#### noSpacesInFileNames
|
|
120
137
|
The 'beef' we have with spaces in filenames is twofold:
|
|
121
138
|
|
|
122
|
-
|
|
123
|
-
|
|
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.
|
|
124
143
|
|
|
125
|
-
|
|
144
|
+
- Default: true
|
|
145
|
+
- Severity: WARNING
|
|
126
146
|
|
|
127
|
-
|
|
128
|
-
* Severity: WARNING
|
|
147
|
+
### noTabs
|
|
129
148
|
|
|
130
|
-
|
|
131
|
-
Whilst there are some arguments for using tabs to indent (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).
|
|
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).
|
|
132
150
|
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
- Alias: noTabIndentation
|
|
152
|
+
- Default: true
|
|
153
|
+
- Severity: WARNING
|
|
135
154
|
|
|
136
|
-
|
|
137
|
-
This will highlight lines with trailing spaces. Trailing spaces serve no useful purpose in a SAS program.
|
|
155
|
+
### noTrailingSpaces
|
|
138
156
|
|
|
139
|
-
|
|
140
|
-
* severity: WARNING
|
|
157
|
+
This will highlight lines with trailing spaces. Trailing spaces serve no useful purpose in a SAS program.
|
|
141
158
|
|
|
142
|
-
|
|
159
|
+
- Default: true
|
|
160
|
+
- severity: WARNING
|
|
143
161
|
|
|
144
|
-
|
|
145
|
-
* `noGremlins` -> identifies all invisible characters, other than spaces / tabs / line endings. If you really need that bell character, use a hex literal!
|
|
146
|
-
* `lineEndings` -> set a standard line ending, such as LF or CRLF
|
|
162
|
+
## severityLevel
|
|
147
163
|
|
|
148
|
-
|
|
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:
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"noTrailingSpaces": true,
|
|
169
|
+
"hasDoxygenHeader": true,
|
|
170
|
+
"maxLineLength": 100,
|
|
171
|
+
"severityLevel": {
|
|
172
|
+
"hasDoxygenHeader": "warn",
|
|
173
|
+
"maxLineLength": "error",
|
|
174
|
+
"noTrailingSpaces": "error"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
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)
|
|
181
|
+
|
|
182
|
+
## Upcoming Linting Rules:
|
|
183
|
+
|
|
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
|
|
186
|
+
|
|
187
|
+
# SAS Formatter
|
|
149
188
|
|
|
150
189
|
A formatter will automatically apply rules when you hit SAVE, which can save a LOT of time.
|
|
151
190
|
|
|
152
191
|
We've already implemented the following rules:
|
|
153
192
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
193
|
+
- Add the macro name to the %mend statement
|
|
194
|
+
- Add a doxygen header template if none exists
|
|
195
|
+
- Remove trailing spaces
|
|
157
196
|
|
|
158
197
|
We're looking to implement the following rules:
|
|
159
198
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
199
|
+
- Change tabs to spaces
|
|
200
|
+
- zap gremlins
|
|
201
|
+
- fix line endings
|
|
163
202
|
|
|
164
203
|
We are also investigating some harder stuff, such as automatic indentation and code layout
|
|
165
204
|
|
|
166
|
-
|
|
205
|
+
# Sponsorship & Contributions
|
|
167
206
|
|
|
168
|
-
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?
|
|
169
208
|
|
|
170
209
|
Contact [Allan Bowe](https://www.linkedin.com/in/allanbowe/) for further details.
|
|
171
210
|
|
|
211
|
+
# Contributors ✨
|
|
172
212
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
## Contributors ✨
|
|
176
213
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
214
|
+
|
|
177
215
|
[](#contributors-)
|
|
216
|
+
|
|
178
217
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
218
|
+
|
|
179
219
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
180
220
|
|
|
181
221
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
package/lint/shared.js
CHANGED
|
@@ -36,7 +36,7 @@ exports.processText = processText;
|
|
|
36
36
|
var processFile = function (filePath, config) {
|
|
37
37
|
var diagnostics = [];
|
|
38
38
|
config.pathLintRules.forEach(function (rule) {
|
|
39
|
-
diagnostics.push.apply(diagnostics, __spreadArray([], __read(rule.test(filePath))));
|
|
39
|
+
diagnostics.push.apply(diagnostics, __spreadArray([], __read(rule.test(filePath, config))));
|
|
40
40
|
});
|
|
41
41
|
return diagnostics;
|
|
42
42
|
};
|
|
@@ -44,7 +44,7 @@ exports.processFile = processFile;
|
|
|
44
44
|
var processContent = function (config, content) {
|
|
45
45
|
var diagnostics = [];
|
|
46
46
|
config.fileLintRules.forEach(function (rule) {
|
|
47
|
-
diagnostics.push.apply(diagnostics, __spreadArray([], __read(rule.test(content))));
|
|
47
|
+
diagnostics.push.apply(diagnostics, __spreadArray([], __read(rule.test(content, config))));
|
|
48
48
|
});
|
|
49
49
|
return diagnostics;
|
|
50
50
|
};
|
package/lint/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/lint/shared.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,kCAAoC;AAE7B,IAAM,WAAW,GAAG,UAAC,IAAY,EAAE,MAAkB;IAC1D,IAAM,KAAK,GAAG,iBAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACrC,IAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,WAAW,CAAC,IAAI,OAAhB,WAAW,2BAAS,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,IAAC;IACjD,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,KAAK;QACxB,WAAW,CAAC,IAAI,OAAhB,WAAW,2BAAS,mBAAW,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,IAAC;IAC3D,CAAC,CAAC,CAAA;IAEF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AATY,QAAA,WAAW,eASvB;AAEM,IAAM,WAAW,GAAG,UACzB,QAAgB,EAChB,MAAkB;IAElB,IAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,UAAC,IAAI;QAChC,WAAW,CAAC,IAAI,OAAhB,WAAW,2BAAS,IAAI,C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AAC,CAAC,CAAA;IAEF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAEM,IAAM,WAAW,GAAG,UACzB,MAAkB,EAClB,IAAY,EACZ,UAAkB;IAElB,IAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,UAAC,IAAI;QAChC,WAAW,CAAC,IAAI,OAAhB,WAAW,2BAAS,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,IAAC;IAC1D,CAAC,CAAC,CAAA;IAEF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAXY,QAAA,WAAW,eAWvB"}
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ var messageForSingleAsterisk = 'File not following Doxygen header style, use dou
|
|
|
13
13
|
var test = function (value, config) {
|
|
14
14
|
var _a;
|
|
15
15
|
var lineEnding = (config === null || config === void 0 ? void 0 : config.lineEndings) === LineEndings_1.LineEndings.CRLF ? '\r\n' : '\n';
|
|
16
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || Severity_1.Severity.Warning;
|
|
16
17
|
try {
|
|
17
18
|
var hasFileHeader = value.trimStart().startsWith('/**');
|
|
18
19
|
if (hasFileHeader)
|
|
@@ -26,7 +27,7 @@ var test = function (value, config) {
|
|
|
26
27
|
.length + 1,
|
|
27
28
|
startColumnNumber: 1,
|
|
28
29
|
endColumnNumber: 1,
|
|
29
|
-
severity:
|
|
30
|
+
severity: severity
|
|
30
31
|
}
|
|
31
32
|
];
|
|
32
33
|
return [
|
|
@@ -35,7 +36,7 @@ var test = function (value, config) {
|
|
|
35
36
|
lineNumber: 1,
|
|
36
37
|
startColumnNumber: 1,
|
|
37
38
|
endColumnNumber: 1,
|
|
38
|
-
severity:
|
|
39
|
+
severity: severity
|
|
39
40
|
}
|
|
40
41
|
];
|
|
41
42
|
}
|
|
@@ -46,7 +47,7 @@ var test = function (value, config) {
|
|
|
46
47
|
lineNumber: 1,
|
|
47
48
|
startColumnNumber: 1,
|
|
48
49
|
endColumnNumber: 1,
|
|
49
|
-
severity:
|
|
50
|
+
severity: severity
|
|
50
51
|
}
|
|
51
52
|
];
|
|
52
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasDoxygenHeader.js","sourceRoot":"","sources":["../../../src/rules/file/hasDoxygenHeader.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AACxC,uDAAqD;AAErD,yDAAuD;AACvD,iDAA+C;AAC/C,2DAAoE;AAEpE,IAAM,IAAI,GAAG,kBAAkB,CAAA;AAC/B,IAAM,WAAW,GACf,qEAAqE,CAAA;AACvE,IAAM,OAAO,GAAG,6BAA6B,CAAA;AAC7C,IAAM,wBAAwB,GAC5B,+DAA+D,CAAA;
|
|
1
|
+
{"version":3,"file":"hasDoxygenHeader.js","sourceRoot":"","sources":["../../../src/rules/file/hasDoxygenHeader.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AACxC,uDAAqD;AAErD,yDAAuD;AACvD,iDAA+C;AAC/C,2DAAoE;AAEpE,IAAM,IAAI,GAAG,kBAAkB,CAAA;AAC/B,IAAM,WAAW,GACf,qEAAqE,CAAA;AACvE,IAAM,OAAO,GAAG,6BAA6B,CAAA;AAC7C,IAAM,wBAAwB,GAC5B,+DAA+D,CAAA;AAEjE,IAAM,IAAI,GAAG,UAAC,KAAa,EAAE,MAAmB;;IAC9C,IAAM,UAAU,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,MAAK,yBAAW,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA;IAC3E,IAAM,QAAQ,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,IAAI,CAAC,KAAI,mBAAQ,CAAC,OAAO,CAAA;IAEhE,IAAI;QACF,IAAM,aAAa,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,UAA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AAC,CAAA;IAC3D,IAAM,gBAAgB,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,yBAAW,CAAC,EAAE,CAAA;IAC9D,IAAM,UAAU,GAAG,gBAAgB,KAAK,yBAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;IAEtE,OAAO,MAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,OAAO,CACrC,eAAe,EACf,UAAU,CACX,IAAG,UAAU,GAAG,KAAO,CAAA;AAC1B,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;IACJ,GAAG,KAAA;CACJ,CAAA"}
|
|
@@ -13,6 +13,7 @@ var test = function (value, config) {
|
|
|
13
13
|
var lineEnding = (config === null || config === void 0 ? void 0 : config.lineEndings) === LineEndings_1.LineEndings.CRLF ? '\r\n' : '\n';
|
|
14
14
|
var lines = value ? value.split(lineEnding) : [];
|
|
15
15
|
var macros = parseMacros_1.parseMacros(value, config);
|
|
16
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || Severity_1.Severity.Warning;
|
|
16
17
|
var diagnostics = [];
|
|
17
18
|
macros.forEach(function (macro) {
|
|
18
19
|
if (macro.startLineNumbers.length === 0 && macro.endLineNumber !== null) {
|
|
@@ -22,7 +23,7 @@ var test = function (value, config) {
|
|
|
22
23
|
lineNumber: macro.endLineNumber,
|
|
23
24
|
startColumnNumber: getColumnNumber_1.getColumnNumber(endLine, '%mend'),
|
|
24
25
|
endColumnNumber: getColumnNumber_1.getColumnNumber(endLine, '%mend') + macro.termination.length,
|
|
25
|
-
severity:
|
|
26
|
+
severity: severity
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
else if (macro.endLineNumber === null &&
|
|
@@ -32,7 +33,7 @@ var test = function (value, config) {
|
|
|
32
33
|
lineNumber: macro.startLineNumbers[0],
|
|
33
34
|
startColumnNumber: 1,
|
|
34
35
|
endColumnNumber: 1,
|
|
35
|
-
severity:
|
|
36
|
+
severity: severity
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
else if (macro.mismatchedMendMacroName) {
|
|
@@ -44,7 +45,7 @@ var test = function (value, config) {
|
|
|
44
45
|
endColumnNumber: getColumnNumber_1.getColumnNumber(endLine, macro.mismatchedMendMacroName) +
|
|
45
46
|
macro.mismatchedMendMacroName.length -
|
|
46
47
|
1,
|
|
47
|
-
severity:
|
|
48
|
+
severity: severity
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
else if (!macro.hasMacroNameInMend) {
|
|
@@ -54,7 +55,7 @@ var test = function (value, config) {
|
|
|
54
55
|
lineNumber: macro.endLineNumber,
|
|
55
56
|
startColumnNumber: getColumnNumber_1.getColumnNumber(endLine, '%mend'),
|
|
56
57
|
endColumnNumber: getColumnNumber_1.getColumnNumber(endLine, '%mend') + 6,
|
|
57
|
-
severity:
|
|
58
|
+
severity: severity
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasMacroNameInMend.js","sourceRoot":"","sources":["../../../src/rules/file/hasMacroNameInMend.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,iDAA+C;AAC/C,+DAA6D;AAE7D,uDAAqD;AACrD,uDAAqD;AAErD,IAAM,IAAI,GAAG,oBAAoB,CAAA;AACjC,IAAM,WAAW,GACf,kEAAkE,CAAA;AACpE,IAAM,OAAO,GAAG,qDAAqD,CAAA;
|
|
1
|
+
{"version":3,"file":"hasMacroNameInMend.js","sourceRoot":"","sources":["../../../src/rules/file/hasMacroNameInMend.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,iDAA+C;AAC/C,+DAA6D;AAE7D,u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;IAE5C,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAED;;GAEG;AACU,QAAA,kBAAkB,GAAiB;IAC9C,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI,MAAA;IACJ,WAAW,aAAA;IACX,OAAO,SAAA;IACP,IAAI,MAAA;IACJ,GAAG,KAAA;CACJ,CAAA"}
|
|
@@ -11,6 +11,7 @@ var message = 'Macro definition missing parentheses';
|
|
|
11
11
|
var test = function (value, config) {
|
|
12
12
|
var diagnostics = [];
|
|
13
13
|
var macros = parseMacros_1.parseMacros(value, config);
|
|
14
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || Severity_1.Severity.Warning;
|
|
14
15
|
macros.forEach(function (macro) {
|
|
15
16
|
if (!macro.name) {
|
|
16
17
|
diagnostics.push({
|
|
@@ -19,7 +20,7 @@ var test = function (value, config) {
|
|
|
19
20
|
startColumnNumber: getColumnNumber_1.getColumnNumber(macro.declarationLines[0], '%macro'),
|
|
20
21
|
endColumnNumber: getColumnNumber_1.getColumnNumber(macro.declarationLines[0], '%macro') +
|
|
21
22
|
macro.declaration.length,
|
|
22
|
-
severity:
|
|
23
|
+
severity: severity
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
else if (!macro.declarationLines.find(function (dl) { return dl.includes('('); })) {
|
|
@@ -33,7 +34,7 @@ var test = function (value, config) {
|
|
|
33
34
|
endColumnNumber: getColumnNumber_1.getColumnNumber(macro.declarationLines[macroNameLineIndex], macro.name) +
|
|
34
35
|
macro.name.length -
|
|
35
36
|
1,
|
|
36
|
-
severity:
|
|
37
|
+
severity: severity
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasMacroParentheses.js","sourceRoot":"","sources":["../../../src/rules/file/hasMacroParentheses.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,iDAA+C;AAC/C,+DAA6D;AAC7D,uDAAqD;A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,CAAC,GAAG,CAAC,EAAhB,CAAgB,CAAC,EAAE;YACjE,IAAM,kBAAkB,GAAG,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAC,EAAE;gBAC7D,OAAA,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;YAAvB,CAAuB,CACxB,CAAA;YACD,WAAW,CAAC,IAAI,CAAC;gBACf,OAAO,SAAA;gBACP,UAAU,EAAE,KAAK,CAAC,gBAAiB,CAAC,kBAAkB,CAAC;gBACvD,iBAAiB,EAAE,iCAAe,CAChC,KAAK,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,EAC1C,KAAK,CAAC,IAAI,CACX;gBACD,eAAe,EACb,iCAAe,CACb,KAAK,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,EAC1C,KAAK,CAAC,IAAI,CACX;oBACD,KAAK,CAAC,IAAI,CAAC,MAAM;oBACjB,CAAC;gBACH,QAAQ,UAAA;aACT,CAAC,CAAA;SACH;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED;;GAEG;AACU,QAAA,mBAAmB,GAAiB;IAC/C,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI,MAAA;IACJ,WAAW,aAAA;IACX,OAAO,SAAA;IACP,IAAI,MAAA;CACL,CAAA"}
|
|
@@ -16,6 +16,7 @@ var test = function (value, config) {
|
|
|
16
16
|
.replace(/\n/g, '{lf}')
|
|
17
17
|
.split(new RegExp("(?<=" + expectedLineEnding + ")"));
|
|
18
18
|
var diagnostics = [];
|
|
19
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || Severity_1.Severity.Warning;
|
|
19
20
|
var indexOffset = 0;
|
|
20
21
|
lines.forEach(function (line, index) {
|
|
21
22
|
if (line.endsWith(incorrectLineEnding)) {
|
|
@@ -26,7 +27,7 @@ var test = function (value, config) {
|
|
|
26
27
|
lineNumber: index + 1 + indexOffset,
|
|
27
28
|
startColumnNumber: line.indexOf(incorrectLineEnding),
|
|
28
29
|
endColumnNumber: line.indexOf(incorrectLineEnding) + 1,
|
|
29
|
-
severity:
|
|
30
|
+
severity: severity
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
@@ -43,7 +44,7 @@ var test = function (value, config) {
|
|
|
43
44
|
lineNumber: index + i + 1,
|
|
44
45
|
startColumnNumber: l.indexOf(incorrectLineEnding),
|
|
45
46
|
endColumnNumber: l.indexOf(incorrectLineEnding) + 1,
|
|
46
|
-
severity:
|
|
47
|
+
severity: severity
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineEndings.js","sourceRoot":"","sources":["../../../src/rules/file/lineEndings.ts"],"names":[],"mappings":";;;AACA,uDAAqD;AAErD,yDAAuD;AACvD,iDAA+C;AAE/C,IAAM,IAAI,GAAG,aAAa,CAAA;AAC1B,IAAM,WAAW,GAAG,sDAAsD,CAAA;AAC1E,IAAM,OAAO,GAAG,wDAAwD,CAAA;
|
|
1
|
+
{"version":3,"file":"lineEndings.js","sourceRoot":"","sources":["../../../src/rules/file/lineEndings.ts"],"names":[],"mappings":";;;AACA,uDAAqD;AAErD,yDAAuD;AACvD,iDAA+C;AAE/C,IAAM,IAAI,GAAG,aAAa,CAAA;AAC1B,IAAM,WAAW,GAAG,sDAAsD,CAAA;AAC1E,IAAM,OAAO,GAAG,wDAAwD,CAAA;AAExE,IAAM,IAAI,GAAG,UAAC,KAAa,EAAE,MAAmB;IAC9C,IAAM,gBAAgB,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,yBAAW,CAAC,EAAE,CAAA;IAC9D,IAAM,kBAAkB,GACtB,gBAAgB,KAAK,yBAAW,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAA;IACzD,IAAM,mBAAmB,GAAG,kBAAkB,KA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AA;AAC1E,CAAC,CAAA;AAED;;GAEG;AACU,QAAA,WAAW,GAAiB;IACvC,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI,MAAA;IACJ,WAAW,aAAA;IACX,OAAO,SAAA;IACP,IAAI,MAAA;IACJ,GAAG,KAAA;CACJ,CAAA"}
|
|
@@ -14,6 +14,7 @@ var test = function (value, config) {
|
|
|
14
14
|
var lines = value ? value.split(lineEnding) : [];
|
|
15
15
|
var diagnostics = [];
|
|
16
16
|
var macros = parseMacros_1.parseMacros(value, config);
|
|
17
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || Severity_1.Severity.Warning;
|
|
17
18
|
macros
|
|
18
19
|
.filter(function (m) { return !!m.parentMacro; })
|
|
19
20
|
.forEach(function (macro) {
|
|
@@ -26,7 +27,7 @@ var test = function (value, config) {
|
|
|
26
27
|
endColumnNumber: getColumnNumber_1.getColumnNumber(lines[macro.startLineNumbers[0] - 1], '%macro') +
|
|
27
28
|
lines[macro.startLineNumbers[0] - 1].trim().length -
|
|
28
29
|
1,
|
|
29
|
-
severity:
|
|
30
|
+
severity: severity
|
|
30
31
|
});
|
|
31
32
|
});
|
|
32
33
|
return diagnostics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noNestedMacros.js","sourceRoot":"","sources":["../../../src/rules/file/noNestedMacros.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,iDAA+C;AAC/C,+DAA6D;AAC7D,uDAAqD;AAErD,uDAAqD;AAErD,IAAM,IAAI,GAAG,gBAAgB,CAAA;AAC7B,IAAM,WAAW,GAAG,kDAAkD,CAAA;AACtE,IAAM,OAAO,GAAG,4DAA4D,CAAA;
|
|
1
|
+
{"version":3,"file":"noNestedMacros.js","sourceRoot":"","sources":["../../../src/rules/file/noNestedMacros.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,iDAA+C;AAC/C,+DAA6D;AAC7D,uDAAqD;AAErD,uDAAqD;AAEr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,EACjD,QAAQ,CACT;gBACD,KAAK,CAAE,KAAK,CAAC,gBAAiB,CAAC,CAAC,CAAY,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM;gBAC/D,CAAC;YACH,QAAQ,UAAA;SACT,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACJ,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED;;GAEG;AACU,QAAA,cAAc,GAAiB;IAC1C,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI,MAAA;IACJ,WAAW,aAAA;IACX,OAAO,SAAA;IACP,IAAI,MAAA;CACL,CAAA"}
|
|
@@ -21,8 +21,9 @@ var validOptions = [
|
|
|
21
21
|
'SRC',
|
|
22
22
|
'STORE'
|
|
23
23
|
];
|
|
24
|
-
var processParams = function (content, macro, diagnostics) {
|
|
24
|
+
var processParams = function (content, macro, diagnostics, config) {
|
|
25
25
|
var declaration = macro.declaration;
|
|
26
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || types_1.Severity.Warning;
|
|
26
27
|
var regExpParams = new RegExp(/(?<=\().*(?=\))/);
|
|
27
28
|
var regExpParamsResult = regExpParams.exec(declaration);
|
|
28
29
|
var _declaration = declaration;
|
|
@@ -68,7 +69,7 @@ var processParams = function (content, macro, diagnostics) {
|
|
|
68
69
|
lineNumber: paramLineNumber,
|
|
69
70
|
startColumnNumber: paramStartIndex + 1,
|
|
70
71
|
endColumnNumber: paramEndIndex,
|
|
71
|
-
severity:
|
|
72
|
+
severity: severity
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
});
|
|
@@ -76,9 +77,10 @@ var processParams = function (content, macro, diagnostics) {
|
|
|
76
77
|
}
|
|
77
78
|
return _declaration;
|
|
78
79
|
};
|
|
79
|
-
var processOptions = function (_declaration, macro, diagnostics) {
|
|
80
|
+
var processOptions = function (_declaration, macro, diagnostics, config) {
|
|
80
81
|
var _a, _b, _c;
|
|
81
82
|
var optionsPresent = (_b = (_a = _declaration.split('/')) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim();
|
|
83
|
+
var severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || types_1.Severity.Warning;
|
|
82
84
|
if (optionsPresent) {
|
|
83
85
|
var regex = new RegExp(/="(.*?)"/, 'g');
|
|
84
86
|
var result = regex.exec(optionsPresent);
|
|
@@ -100,7 +102,7 @@ var processOptions = function (_declaration, macro, diagnostics) {
|
|
|
100
102
|
lineNumber: macro.startLineNumbers[declarationLineIndex],
|
|
101
103
|
startColumnNumber: declarationLine.indexOf(trimmedOption) + 1,
|
|
102
104
|
endColumnNumber: declarationLine.indexOf(trimmedOption) + trimmedOption.length,
|
|
103
|
-
severity:
|
|
105
|
+
severity: severity
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
108
|
});
|
|
@@ -110,8 +112,8 @@ var test = function (value, config) {
|
|
|
110
112
|
var diagnostics = [];
|
|
111
113
|
var macros = parseMacros_1.parseMacros(value, config);
|
|
112
114
|
macros.forEach(function (macro) {
|
|
113
|
-
var _declaration = processParams(value, macro, diagnostics);
|
|
114
|
-
processOptions(_declaration, macro, diagnostics);
|
|
115
|
+
var _declaration = processParams(value, macro, diagnostics, config);
|
|
116
|
+
processOptions(_declaration, macro, diagnostics, config);
|
|
115
117
|
});
|
|
116
118
|
return diagnostics;
|
|
117
119
|
};
|