@atlisp/lint 0.1.9 → 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.
@@ -9,7 +9,7 @@
9
9
  "encoding": "error",
10
10
  "cl_syntax": "warn",
11
11
  "quit_exit": "error",
12
- "command_shell": "error",
12
+ "command_shell": "warn",
13
13
  "startapp": "warn",
14
14
  "vl_registry_write": "warn",
15
15
  "vlax_without_loading": "warn",
@@ -95,7 +95,7 @@
95
95
  "dangerous_calls": {
96
96
  "quit": "error",
97
97
  "exit": "error",
98
- "command_shell": "error",
98
+ "command_shell": "warn",
99
99
  "startapp": "warn",
100
100
  "vl_registry_write": "warn"
101
101
  },
@@ -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/dist/config.js CHANGED
@@ -51,7 +51,7 @@ const DEFAULT_CONFIG = {
51
51
  encoding: 'error',
52
52
  cl_syntax: 'warn',
53
53
  quit_exit: 'error',
54
- command_shell: 'error',
54
+ command_shell: 'warn',
55
55
  startapp: 'warn',
56
56
  vl_registry_write: 'warn',
57
57
  vlax_without_loading: 'warn',
@@ -137,7 +137,7 @@ const DEFAULT_CONFIG = {
137
137
  dangerous_calls: {
138
138
  quit: 'error',
139
139
  exit: 'error',
140
- command_shell: 'error',
140
+ command_shell: 'warn',
141
141
  startapp: 'warn',
142
142
  vl_registry_write: 'warn',
143
143
  },
package/dist/index.js CHANGED
@@ -164,10 +164,11 @@ function* walkFiles(dir, rootDir, regex) {
164
164
  function globFiles(pattern, rootDir) {
165
165
  const regexStr = pattern
166
166
  .replace(/\./g, '\\.')
167
- .replace(/\*\*\//g, '(.*/)?')
167
+ .replace(/\*\*\//g, '\x00GLOB\x00')
168
168
  .replace(/\*\*/g, '.*')
169
169
  .replace(/\*/g, '[^/]*')
170
- .replace(/\?/g, '.');
170
+ .replace(/\?/g, '.')
171
+ .replace(/\x00GLOB\x00/g, '(.*/)?');
171
172
  const regex = new RegExp(`^${regexStr}$`);
172
173
  return Array.from(walkFiles(rootDir, rootDir, regex));
173
174
  }
@@ -195,7 +196,11 @@ function collectFiles(rootDir, opts, config) {
195
196
  }
196
197
  }
197
198
  const excludePatterns = config.source.exclude.map(e => {
198
- const str = e.replace(/\./g, '\\.').replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*');
199
+ const str = e
200
+ .replace(/\./g, '\\.')
201
+ .replace(/\*\*/g, '\x00STAR\x00')
202
+ .replace(/\*/g, '[^/]*')
203
+ .replace(/\x00STAR\x00/g, '.*');
199
204
  return new RegExp(`^${str}$`);
200
205
  });
201
206
  return Array.from(files)
package/dist/presets.js CHANGED
@@ -8,7 +8,7 @@ exports.PRESETS = {
8
8
  encoding: 'error',
9
9
  cl_syntax: 'warn',
10
10
  quit_exit: 'error',
11
- command_shell: 'error',
11
+ command_shell: 'warn',
12
12
  startapp: 'warn',
13
13
  vl_registry_write: 'warn',
14
14
  token_in_url: 'warn',
@@ -74,7 +74,7 @@ exports.PRESETS = {
74
74
  encoding: 'error',
75
75
  cl_syntax: 'error',
76
76
  quit_exit: 'error',
77
- command_shell: 'error',
77
+ command_shell: 'warn',
78
78
  startapp: 'error',
79
79
  vl_registry_write: 'error',
80
80
  vlax_without_loading: 'error',
@@ -152,7 +152,7 @@ exports.PRESETS = {
152
152
  parens: 'error',
153
153
  encoding: 'error',
154
154
  quit_exit: 'error',
155
- command_shell: 'error',
155
+ command_shell: 'warn',
156
156
  },
157
157
  },
158
158
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlisp/lint",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "AutoLISP static analysis tool — parens, security, conventions, SBCL syntax validation",
5
5
  "keywords": [
6
6
  "CAD",