@atlisp/lint 0.1.22 → 0.1.24
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/dist/atlisp-lint.default.json +90 -0
- package/dist/checks/arg-count.js +1 -1
- package/dist/checks/assoc-without-cdr.js +1 -1
- package/dist/checks/cond-duplicate.js +1 -1
- package/dist/checks/constant-condition.js +3 -3
- package/dist/checks/dangerous-calls.js +1 -1
- package/dist/checks/dangling-defun.js +1 -1
- package/dist/checks/double-not.js +1 -1
- package/dist/checks/empty-branch.js +1 -1
- package/dist/checks/empty-catch.js +1 -1
- package/dist/checks/function-complexity.js +1 -1
- package/dist/checks/global-naming.js +1 -1
- package/dist/checks/identical-branches.js +1 -1
- package/dist/checks/misplaced-else.js +1 -1
- package/dist/checks/multiple-setq.js +1 -1
- package/dist/checks/no-return.js +1 -1
- package/dist/checks/open-close.js +1 -1
- package/dist/checks/parameter-naming.js +1 -1
- package/dist/checks/quote-vs-function.js +1 -1
- package/dist/checks/recursive-call.js +1 -1
- package/dist/checks/redundant-let.js +1 -1
- package/dist/checks/redundant-nil-else.js +1 -1
- package/dist/checks/redundant-progn.js +1 -1
- package/dist/checks/redundant-quotes.js +1 -1
- package/dist/checks/redundant-setq.js +1 -1
- package/dist/checks/self-compare.js +1 -1
- package/dist/checks/setq-single-arg.js +1 -1
- package/dist/checks/single-arg-and-or.js +1 -1
- package/dist/checks/undeclared-setq.js +1 -1
- package/dist/checks/unused-catch-result.js +1 -1
- package/dist/checks/unused-let.js +1 -1
- package/dist/checks/unused-local-fun.js +1 -1
- package/dist/checks/unused-package-dep.js +1 -1
- package/dist/checks/unused-param.js +1 -1
- package/dist/checks/unused-variable.js +1 -1
- package/dist/checks/variable-shadow.js +1 -1
- package/dist/checks/while-constant.js +1 -1
- package/dist/formatters.d.ts +0 -1
- package/dist/formatters.js +0 -16
- package/dist/lib/lint-sbcl.lisp +161 -0
- package/dist/project.js +5 -5
- package/dist/runner.d.ts +1 -1
- package/dist/runner.js +207 -93
- package/dist/stub-packages.json +41 -0
- package/dist/visitor-runner.js +5 -9
- package/package.json +2 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"locale": "zh",
|
|
3
|
+
"source": {
|
|
4
|
+
"globs": ["**/*.lsp"],
|
|
5
|
+
"exclude": ["**/node_modules/**", "**/vendor/**", "**/.git/**"]
|
|
6
|
+
},
|
|
7
|
+
"checks": {
|
|
8
|
+
"parens": "error",
|
|
9
|
+
"encoding": "warn",
|
|
10
|
+
"cl_syntax": "warn",
|
|
11
|
+
"quit_exit": "error",
|
|
12
|
+
"command_shell": "error",
|
|
13
|
+
"startapp": "warn",
|
|
14
|
+
"vl_registry_write": "warn",
|
|
15
|
+
"vlax_without_loading": "off",
|
|
16
|
+
"token_in_url": "warn",
|
|
17
|
+
"open_without_close": "warn",
|
|
18
|
+
"bare_function_names": "off",
|
|
19
|
+
"line_length": "warn",
|
|
20
|
+
"function_complexity": "warn",
|
|
21
|
+
"parameter_naming": "warn",
|
|
22
|
+
"unused_variable": "warn",
|
|
23
|
+
"missing_doc": "warn",
|
|
24
|
+
"error_handling": "warn",
|
|
25
|
+
"global_naming": "warn",
|
|
26
|
+
"extra_parens": "warn",
|
|
27
|
+
"arg_count": "warn",
|
|
28
|
+
"strcat_usage": "warn",
|
|
29
|
+
"cond_simplify": "warn",
|
|
30
|
+
"redundant_progn": "warn",
|
|
31
|
+
"quote_style": "warn",
|
|
32
|
+
"eq_usage": "warn",
|
|
33
|
+
"lambda_syntax": "warn",
|
|
34
|
+
"comment_style": "warn",
|
|
35
|
+
"empty_catch": "warn",
|
|
36
|
+
"nth_usage": "warn",
|
|
37
|
+
"append_single": "warn",
|
|
38
|
+
"setq_multiple": "warn",
|
|
39
|
+
"function_order": "off",
|
|
40
|
+
"magic_number": "off",
|
|
41
|
+
"mixed_indent": "warn",
|
|
42
|
+
"long_function_call": "warn",
|
|
43
|
+
"no_return": "warn",
|
|
44
|
+
"shadow_builtin": "warn",
|
|
45
|
+
"dynamic_doc": "warn",
|
|
46
|
+
"loop_optimization": "off",
|
|
47
|
+
"type_check": "off",
|
|
48
|
+
"redundant_if": "warn",
|
|
49
|
+
"trailing_whitespace": "warn",
|
|
50
|
+
"module_registration": "off",
|
|
51
|
+
"namespace_header": "off"
|
|
52
|
+
},
|
|
53
|
+
"line_length": {
|
|
54
|
+
"max": 100,
|
|
55
|
+
"tab_width": 2
|
|
56
|
+
},
|
|
57
|
+
"function_complexity": {
|
|
58
|
+
"max_lines": 60,
|
|
59
|
+
"max_nesting": 6
|
|
60
|
+
},
|
|
61
|
+
"cl_syntax": {
|
|
62
|
+
"keywords": ["&key"]
|
|
63
|
+
},
|
|
64
|
+
"dangerous_calls": {
|
|
65
|
+
"quit": "error",
|
|
66
|
+
"exit": "error",
|
|
67
|
+
"command_shell": "error",
|
|
68
|
+
"startapp": "warn",
|
|
69
|
+
"vl_registry_write": "warn"
|
|
70
|
+
},
|
|
71
|
+
"module_registration": {
|
|
72
|
+
"severity": "off",
|
|
73
|
+
"patterns": [],
|
|
74
|
+
"dirs": ["modules"]
|
|
75
|
+
},
|
|
76
|
+
"namespace_header": {
|
|
77
|
+
"severity": "off",
|
|
78
|
+
"package": "",
|
|
79
|
+
"deps": [],
|
|
80
|
+
"search_lines": 15
|
|
81
|
+
},
|
|
82
|
+
"bare_function_names": {
|
|
83
|
+
"allowlist": ["T", "nil"],
|
|
84
|
+
"namespace_pattern": "^[a-z]+:"
|
|
85
|
+
},
|
|
86
|
+
"sbcl": {
|
|
87
|
+
"walk_exclude": [".vscode", "vendor", ".git"],
|
|
88
|
+
"defmacro_allow_files": ["compat-cl"]
|
|
89
|
+
}
|
|
90
|
+
}
|
package/dist/checks/arg-count.js
CHANGED
|
@@ -5,7 +5,7 @@ const locale_1 = require("../locale");
|
|
|
5
5
|
const parser_1 = require("@atlisp/parser");
|
|
6
6
|
function checkArgCount(content, file) {
|
|
7
7
|
const issues = [];
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
const defuns = (0, parser_1.astFindListWithHead)(ast, 'defun');
|
|
10
10
|
for (const defun of defuns) {
|
|
11
11
|
if (!defun.children || defun.children.length < 3)
|
|
@@ -5,7 +5,7 @@ exports.checkAssocWithoutCdrAst = checkAssocWithoutCdrAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkAssocWithoutCdr(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkAssocWithoutCdrAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkAssocWithoutCdrAst(ast, file) {
|
|
@@ -18,7 +18,7 @@ function condKey(node) {
|
|
|
18
18
|
return '';
|
|
19
19
|
}
|
|
20
20
|
function checkCondDuplicate(content, file) {
|
|
21
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
21
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
22
22
|
return checkCondDuplicateAst(ast, file);
|
|
23
23
|
}
|
|
24
24
|
function checkCondDuplicateAst(ast, file) {
|
|
@@ -7,7 +7,7 @@ const parser_1 = require("@atlisp/parser");
|
|
|
7
7
|
const CONDITION_FORMS = new Set(['if', 'while']);
|
|
8
8
|
const CONSTANTS = new Set(['T', 'nil']);
|
|
9
9
|
function checkConstantCondition(content, file) {
|
|
10
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
10
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
11
11
|
return checkConstantConditionAst(ast, file);
|
|
12
12
|
}
|
|
13
13
|
function checkConstantConditionAst(ast, file) {
|
|
@@ -41,8 +41,8 @@ function checkConstantConditionAst(ast, file) {
|
|
|
41
41
|
continue;
|
|
42
42
|
const condTest = clause.children[0];
|
|
43
43
|
if (condTest.type === 'symbol' && condTest.name && CONSTANTS.has(condTest.name)) {
|
|
44
|
-
// Skip last clause with T
|
|
45
|
-
if (condTest.name === 'T' && i === condNode.children.length - 1)
|
|
44
|
+
// Skip last clause with T (only when there are multiple clauses — else/default pattern)
|
|
45
|
+
if (condTest.name === 'T' && i === condNode.children.length - 1 && i > 1)
|
|
46
46
|
continue;
|
|
47
47
|
issues.push({
|
|
48
48
|
file,
|
|
@@ -36,7 +36,7 @@ function isFunctionCall(list, name) {
|
|
|
36
36
|
return list.children[0].type === 'symbol' && list.children[0].name === name;
|
|
37
37
|
}
|
|
38
38
|
function checkDangerousCalls(content, file, config) {
|
|
39
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
39
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
40
40
|
return checkDangerousCallsAst(ast, file, config);
|
|
41
41
|
}
|
|
42
42
|
function checkDangerousCallsAst(ast, file, config) {
|
|
@@ -40,7 +40,7 @@ const fs = __importStar(require("fs"));
|
|
|
40
40
|
function checkDanglingDefun(file, allDefuns, allReferences) {
|
|
41
41
|
const issues = [];
|
|
42
42
|
const content = fs.readFileSync(file, 'utf-8');
|
|
43
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
43
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
44
44
|
const localDefuns = [];
|
|
45
45
|
const defunNodes = (0, parser_1.astFindAll)(ast, n => (0, parser_1.astIsList)(n, 'defun') || (0, parser_1.astIsList)(n, 'defun-q'));
|
|
46
46
|
for (const node of defunNodes) {
|
|
@@ -5,7 +5,7 @@ exports.checkDoubleNotAst = checkDoubleNotAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkDoubleNot(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkDoubleNotAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkDoubleNotAst(ast, file) {
|
|
@@ -7,7 +7,7 @@ const parser_1 = require("@atlisp/parser");
|
|
|
7
7
|
// AutoLISP only has `if` for conditional branching; `while` with no body is valid (no-op loop)
|
|
8
8
|
const BRANCH_FORMS = new Set(['if']);
|
|
9
9
|
function checkEmptyBranch(content, file) {
|
|
10
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
10
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
11
11
|
return checkEmptyBranchAst(ast, file);
|
|
12
12
|
}
|
|
13
13
|
function checkEmptyBranchAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ const locale_1 = require("../locale");
|
|
|
5
5
|
const parser_1 = require("@atlisp/parser");
|
|
6
6
|
function checkEmptyCatch(content, file) {
|
|
7
7
|
const issues = [];
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
const catchNodes = (0, parser_1.astFindAll)(ast, n => (0, parser_1.astIsList)(n, 'vl-catch-all-apply'));
|
|
10
10
|
for (const node of catchNodes) {
|
|
11
11
|
if (isInQuote(node))
|
|
@@ -5,7 +5,7 @@ exports.checkFunctionComplexityAst = checkFunctionComplexityAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkFunctionComplexity(content, file, maxLines, maxNesting) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkFunctionComplexityAst(ast, file, maxLines, maxNesting);
|
|
10
10
|
}
|
|
11
11
|
function checkFunctionComplexityAst(ast, file, maxLines, maxNesting) {
|
|
@@ -25,7 +25,7 @@ function isInsideLocalScope(node) {
|
|
|
25
25
|
}
|
|
26
26
|
function checkGlobalNaming(content, file) {
|
|
27
27
|
const issues = [];
|
|
28
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
28
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
29
29
|
const setqForms = (0, parser_1.astFindListWithHead)(ast, 'setq');
|
|
30
30
|
for (const form of setqForms) {
|
|
31
31
|
if (!form.children || form.children.length < 2)
|
|
@@ -27,7 +27,7 @@ function astEqual(a, b) {
|
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
function checkIdenticalBranches(content, file) {
|
|
30
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
30
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
31
31
|
return checkIdenticalBranchesAst(ast, file);
|
|
32
32
|
}
|
|
33
33
|
function checkIdenticalBranchesAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkMisplacedElseAst = checkMisplacedElseAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkMisplacedElse(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkMisplacedElseAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkMisplacedElseAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkMultipleSetqAst = checkMultipleSetqAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkMultipleSetq(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkMultipleSetqAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkMultipleSetqAst(ast, file) {
|
package/dist/checks/no-return.js
CHANGED
|
@@ -5,7 +5,7 @@ const locale_1 = require("../locale");
|
|
|
5
5
|
const parser_1 = require("@atlisp/parser");
|
|
6
6
|
function checkNoReturn(content, file) {
|
|
7
7
|
const issues = [];
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
const defuns = (0, parser_1.astFindListWithHead)(ast, 'defun');
|
|
10
10
|
for (const defun of defuns) {
|
|
11
11
|
if (!defun.children || defun.children.length < 3)
|
|
@@ -5,7 +5,7 @@ exports.checkOpenWithoutCloseAst = checkOpenWithoutCloseAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkOpenWithoutClose(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkOpenWithoutCloseAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkOpenWithoutCloseAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkParameterNamingAst = checkParameterNamingAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkParameterNaming(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkParameterNamingAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkParameterNamingAst(ast, file) {
|
|
@@ -17,7 +17,7 @@ const HIGHER_ORDER_FUNCS = new Set([
|
|
|
17
17
|
'vl-every',
|
|
18
18
|
]);
|
|
19
19
|
function checkQuoteVsFunction(content, file) {
|
|
20
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
20
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
21
21
|
return checkQuoteVsFunctionAst(ast, file);
|
|
22
22
|
}
|
|
23
23
|
function checkQuoteVsFunctionAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkRecursiveCallAst = checkRecursiveCallAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkRecursiveCall(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkRecursiveCallAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
/** Forms that provide conditional branching (exit condition for recursion) */
|
|
@@ -5,7 +5,7 @@ exports.checkRedundantLetAst = checkRedundantLetAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkRedundantLet(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkRedundantLetAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkRedundantLetAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkRedundantNilElseAst = checkRedundantNilElseAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkRedundantNilElse(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkRedundantNilElseAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkRedundantNilElseAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkRedundantPrognAst = checkRedundantPrognAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkRedundantProgn(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkRedundantPrognAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkRedundantPrognAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkRedundantQuotesAst = checkRedundantQuotesAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkRedundantQuotes(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkRedundantQuotesAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkRedundantQuotesAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkRedundantSetqAst = checkRedundantSetqAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkRedundantSetq(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkRedundantSetqAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkRedundantSetqAst(ast, file) {
|
|
@@ -6,7 +6,7 @@ const locale_1 = require("../locale");
|
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
const COMPARE_FUNCTIONS = new Set(['=', '/=', '<', '>', '<=', '>=', 'eq', 'equal']);
|
|
8
8
|
function checkSelfCompare(content, file) {
|
|
9
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
9
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
10
10
|
return checkSelfCompareAst(ast, file);
|
|
11
11
|
}
|
|
12
12
|
function checkSelfCompareAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkSetqSingleArgAst = checkSetqSingleArgAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkSetqSingleArg(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkSetqSingleArgAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkSetqSingleArgAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkSingleArgAndOrAst = checkSingleArgAndOrAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkSingleArgAndOr(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkSingleArgAndOrAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkSingleArgAndOrAst(ast, file) {
|
|
@@ -42,7 +42,7 @@ function findEnclosingDefun(node) {
|
|
|
42
42
|
}
|
|
43
43
|
function checkUndeclaredSetq(content, file) {
|
|
44
44
|
const issues = [];
|
|
45
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
45
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
46
46
|
const setqForms = (0, parser_1.astFindListWithHead)(ast, 'setq');
|
|
47
47
|
for (const setq of setqForms) {
|
|
48
48
|
if (!setq.children || setq.children.length < 2)
|
|
@@ -5,7 +5,7 @@ const locale_1 = require("../locale");
|
|
|
5
5
|
const parser_1 = require("@atlisp/parser");
|
|
6
6
|
function checkUnusedCatchResult(content, file) {
|
|
7
7
|
const issues = [];
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
const catchNodes = (0, parser_1.astFindAll)(ast, n => (0, parser_1.astIsList)(n, 'vl-catch-all-apply'));
|
|
10
10
|
for (const node of catchNodes) {
|
|
11
11
|
if (isInQuote(node))
|
|
@@ -5,7 +5,7 @@ exports.checkUnusedLetBindingAst = checkUnusedLetBindingAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkUnusedLetBinding(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkUnusedLetBindingAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkUnusedLetBindingAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkUnusedLocalFunAst = checkUnusedLocalFunAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkUnusedLocalFun(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkUnusedLocalFunAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkUnusedLocalFunAst(ast, file) {
|
|
@@ -40,7 +40,7 @@ const fs = __importStar(require("fs"));
|
|
|
40
40
|
function checkUnusedPackageDep(file) {
|
|
41
41
|
const issues = [];
|
|
42
42
|
const content = fs.readFileSync(file, 'utf-8');
|
|
43
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
43
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
44
44
|
const inPackageNodes = (0, parser_1.astFindAll)(ast, n => (0, parser_1.astIsList)(n, 'in-package'));
|
|
45
45
|
if (inPackageNodes.length === 0)
|
|
46
46
|
return issues;
|
|
@@ -5,7 +5,7 @@ exports.checkUnusedParameterAst = checkUnusedParameterAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkUnusedParameter(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkUnusedParameterAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkUnusedParameterAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkUnusedVariableAst = checkUnusedVariableAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkUnusedVariable(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkUnusedVariableAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkUnusedVariableAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkVariableShadowAst = checkVariableShadowAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkVariableShadow(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkVariableShadowAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkVariableShadowAst(ast, file) {
|
|
@@ -5,7 +5,7 @@ exports.checkWhileConstantAst = checkWhileConstantAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function checkWhileConstant(content, file) {
|
|
8
|
-
const ast = (0, parser_1.parseAst)(content);
|
|
8
|
+
const ast = (0, parser_1.parseAst)(content, { errorRecovery: true });
|
|
9
9
|
return checkWhileConstantAst(ast, file);
|
|
10
10
|
}
|
|
11
11
|
function checkWhileConstantAst(ast, file) {
|
package/dist/formatters.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Issue } from './types';
|
|
2
2
|
export declare function formatDefault(issues: Issue[], fileContents?: Map<string, string>): string;
|
|
3
|
-
export declare function formatHtml(issues: Issue[], errorCount: number, warningCount: number): string;
|
|
4
3
|
export declare function formatJson(issues: Issue[], errorCount?: number, warningCount?: number): string;
|
|
5
4
|
//# sourceMappingURL=formatters.d.ts.map
|
package/dist/formatters.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatDefault = formatDefault;
|
|
4
|
-
exports.formatHtml = formatHtml;
|
|
5
4
|
exports.formatJson = formatJson;
|
|
6
5
|
const locale_1 = require("./locale");
|
|
7
6
|
const colors = {
|
|
@@ -69,21 +68,6 @@ function formatDefault(issues, fileContents) {
|
|
|
69
68
|
}
|
|
70
69
|
return lines.join('\n');
|
|
71
70
|
}
|
|
72
|
-
function formatHtml(issues, errorCount, warningCount) {
|
|
73
|
-
let html = `<!DOCTYPE html>
|
|
74
|
-
<html lang="en">
|
|
75
|
-
<head><meta charset="UTF-8"><title>@atlisp/lint Report</title></head>
|
|
76
|
-
<body>
|
|
77
|
-
<h1>@atlisp/lint Report</h1>
|
|
78
|
-
<p>${errorCount} error(s), ${warningCount} warning(s)</p>
|
|
79
|
-
<ul>
|
|
80
|
-
`;
|
|
81
|
-
for (const iss of issues) {
|
|
82
|
-
html += ` <li>${iss.severity}: ${iss.file}:${iss.line} — ${iss.message}</li>\n`;
|
|
83
|
-
}
|
|
84
|
-
html += '</ul>\n</body>\n</html>';
|
|
85
|
-
return html;
|
|
86
|
-
}
|
|
87
71
|
function formatJson(issues, errorCount, warningCount) {
|
|
88
72
|
return JSON.stringify({
|
|
89
73
|
issues,
|