@atlisp/lint 0.1.10 → 0.1.11

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.
@@ -18,17 +18,7 @@ function checkMissingDoc(content, file) {
18
18
  continue;
19
19
  if (name === 'T' || name === 'nil')
20
20
  continue;
21
- // Check if previous non-empty line is a comment (use raw line, not stripped)
22
- let hasDoc = false;
23
- for (let j = i - 1; j >= 0; j--) {
24
- const prev = lines[j].trim();
25
- if (!prev)
26
- continue;
27
- if (prev.startsWith(';'))
28
- hasDoc = true;
29
- break;
30
- }
31
- if (!hasDoc) {
21
+ if (!hasDocString(lines, i)) {
32
22
  issues.push({
33
23
  file,
34
24
  line: i + 1,
@@ -40,4 +30,65 @@ function checkMissingDoc(content, file) {
40
30
  }
41
31
  return issues;
42
32
  }
33
+ function hasDocString(lines, defunLine) {
34
+ let depth = 0;
35
+ let inArgs = false;
36
+ let argsDone = false;
37
+ let inStr = false;
38
+ let foundExpr = false;
39
+ for (let i = defunLine; i < lines.length; i++) {
40
+ const line = lines[i];
41
+ for (let j = 0; j < line.length; j++) {
42
+ const ch = line[j];
43
+ if (ch === ';' && !inStr)
44
+ break;
45
+ if (inStr) {
46
+ if (ch === '\\') {
47
+ j++;
48
+ continue;
49
+ }
50
+ if (ch === '"') {
51
+ inStr = false;
52
+ if (argsDone && !foundExpr) {
53
+ return true;
54
+ }
55
+ }
56
+ continue;
57
+ }
58
+ if (ch === '"') {
59
+ inStr = true;
60
+ continue;
61
+ }
62
+ if (ch === '(') {
63
+ depth++;
64
+ if (!inArgs && depth === 2)
65
+ inArgs = true;
66
+ if (argsDone && !foundExpr) {
67
+ foundExpr = true;
68
+ }
69
+ continue;
70
+ }
71
+ if (ch === ')') {
72
+ const wasClosingArgList = inArgs && depth === 2;
73
+ if (wasClosingArgList) {
74
+ inArgs = false;
75
+ argsDone = true;
76
+ }
77
+ depth--;
78
+ if (depth === 0)
79
+ return false;
80
+ if (argsDone && !foundExpr && !wasClosingArgList) {
81
+ foundExpr = true;
82
+ }
83
+ continue;
84
+ }
85
+ if (!ch.match(/\s/) && argsDone && !foundExpr) {
86
+ foundExpr = true;
87
+ }
88
+ }
89
+ if (depth === 0)
90
+ break;
91
+ }
92
+ return false;
93
+ }
43
94
  //# sourceMappingURL=missing-doc.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlisp/lint",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "AutoLISP static analysis tool — parens, security, conventions, SBCL syntax validation",
5
5
  "keywords": [
6
6
  "CAD",