@atlisp/lint 0.2.13 → 0.2.14
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.
|
@@ -11,6 +11,7 @@ function checkErrorHandling(content, file) {
|
|
|
11
11
|
let defunStart = 0;
|
|
12
12
|
let defunText = '';
|
|
13
13
|
let hasErrorHandler = false;
|
|
14
|
+
let runningDepth = 0;
|
|
14
15
|
for (let i = 0; i < lines.length; i++) {
|
|
15
16
|
const stripped = (0, utils_1.stripLine)(lines[i]);
|
|
16
17
|
if (!inDefun) {
|
|
@@ -21,22 +22,20 @@ function checkErrorHandling(content, file) {
|
|
|
21
22
|
defunStart = i + 1;
|
|
22
23
|
defunText = '';
|
|
23
24
|
hasErrorHandler = false;
|
|
25
|
+
runningDepth = 0;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
if (inDefun) {
|
|
27
29
|
defunText += stripped + '\n';
|
|
28
30
|
if (stripped.includes('*error*'))
|
|
29
31
|
hasErrorHandler = true;
|
|
30
|
-
// Check for depth returning to 0 (end of defun)
|
|
31
|
-
let depth = 0;
|
|
32
32
|
for (const ch of stripped) {
|
|
33
33
|
if (ch === '(')
|
|
34
|
-
|
|
34
|
+
runningDepth++;
|
|
35
35
|
else if (ch === ')')
|
|
36
|
-
|
|
36
|
+
runningDepth--;
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
39
|
-
// End of defun - check if it uses command but no *error*
|
|
38
|
+
if (runningDepth <= 0 && defunText.trim().length > 0 && defunName) {
|
|
40
39
|
if (/\(command\b/.test(defunText) && !hasErrorHandler && !defunName.startsWith('c:')) {
|
|
41
40
|
issues.push({
|
|
42
41
|
file,
|