@atlisp/lint 0.2.5 → 0.2.6
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 +1 -2
- package/atlisp-lint.default.json +1 -2
- package/dist/checks/cond-duplicate.js +1 -1
- package/dist/config.js +1 -2
- package/dist/presets.js +2 -3
- package/dist/rules.js +1 -2
- package/dist/runner.js +0 -2
- package/dist/validate.js +0 -1
- package/dist/visitor-runner.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ npx @atlisp/lint --format-check
|
|
|
123
123
|
| `nth_usage` | warn | 风格 | (nth 0 ...) 建议 car |
|
|
124
124
|
| `append_single` | warn | 风格 | (append (list ...)) 建议 cons |
|
|
125
125
|
| `mixed_indent` | warn | 风格 | 缩进混用 tab 和空格 |
|
|
126
|
-
| `long_function_call` |
|
|
126
|
+
| `long_function_call` | off | 风格 | 单行参数过多 |
|
|
127
127
|
| `no_return` | warn | 最佳实践 | 函数无返回值 |
|
|
128
128
|
| `shadow_builtin` | warn | 最佳实践 | defun 覆盖内置函数 |
|
|
129
129
|
| `dynamic_doc` | warn | 最佳实践 | C: 命令缺少 (princ) |
|
|
@@ -138,7 +138,6 @@ npx @atlisp/lint --format-check
|
|
|
138
138
|
| `module_registration` | off | 架构 | 模块文件未注册到 \*modules\* |
|
|
139
139
|
| `namespace_header` | off | 架构 | 缺少 (in-package ...) 头 |
|
|
140
140
|
| `loop_optimization` | off | 最佳实践 | 优化 while/assoc 循环 |
|
|
141
|
-
| `type_check` | off | 最佳实践 | getvar 结果未类型检查 |
|
|
142
141
|
| `builtin_arg_count` | error | 正确性 | 内置函数调用参数个数不匹配 |
|
|
143
142
|
| `unused_catch_result` | info | 正确性 | vl-catch-all-apply 结果被当布尔值用 |
|
|
144
143
|
| `string_concat_loop` | info | 性能 | 循环内字符串拼接 |
|
package/atlisp-lint.default.json
CHANGED
|
@@ -73,12 +73,11 @@
|
|
|
73
73
|
"function_order": "off",
|
|
74
74
|
"magic_number": "info",
|
|
75
75
|
"mixed_indent": "warn",
|
|
76
|
-
"long_function_call": "
|
|
76
|
+
"long_function_call": "off",
|
|
77
77
|
"no_return": "warn",
|
|
78
78
|
"shadow_builtin": "warn",
|
|
79
79
|
"dynamic_doc": "warn",
|
|
80
80
|
"loop_optimization": "off",
|
|
81
|
-
"type_check": "off",
|
|
82
81
|
"redundant_if": "warn",
|
|
83
82
|
"undeclared_setq": "warn",
|
|
84
83
|
"unused_catch_result": "off",
|
|
@@ -5,7 +5,7 @@ exports.checkCondDuplicateAst = checkCondDuplicateAst;
|
|
|
5
5
|
const locale_1 = require("../locale");
|
|
6
6
|
const parser_1 = require("@atlisp/parser");
|
|
7
7
|
function condKey(node) {
|
|
8
|
-
if (node.type === 'symbol')
|
|
8
|
+
if (node.type === 'symbol' || node.type === 'keyword')
|
|
9
9
|
return `s:${node.name}`;
|
|
10
10
|
if (node.type === 'number')
|
|
11
11
|
return `n:${node.value}`;
|
package/dist/config.js
CHANGED
|
@@ -115,12 +115,11 @@ const DEFAULT_CONFIG = {
|
|
|
115
115
|
function_order: 'off',
|
|
116
116
|
magic_number: 'off',
|
|
117
117
|
mixed_indent: 'info',
|
|
118
|
-
long_function_call: '
|
|
118
|
+
long_function_call: 'off',
|
|
119
119
|
no_return: 'info',
|
|
120
120
|
shadow_builtin: 'warn',
|
|
121
121
|
dynamic_doc: 'warn',
|
|
122
122
|
loop_optimization: 'info',
|
|
123
|
-
type_check: 'info',
|
|
124
123
|
format_indent: 'off',
|
|
125
124
|
redundant_if: 'info',
|
|
126
125
|
unused_catch_result: 'info',
|
package/dist/presets.js
CHANGED
|
@@ -61,7 +61,7 @@ exports.PRESETS = {
|
|
|
61
61
|
append_single: 'info',
|
|
62
62
|
setq_multiple: 'warn',
|
|
63
63
|
mixed_indent: 'info',
|
|
64
|
-
long_function_call: '
|
|
64
|
+
long_function_call: 'off',
|
|
65
65
|
no_return: 'info',
|
|
66
66
|
shadow_builtin: 'warn',
|
|
67
67
|
dynamic_doc: 'warn',
|
|
@@ -143,12 +143,11 @@ exports.PRESETS = {
|
|
|
143
143
|
function_order: 'off',
|
|
144
144
|
magic_number: 'off',
|
|
145
145
|
mixed_indent: 'error',
|
|
146
|
-
long_function_call: '
|
|
146
|
+
long_function_call: 'off',
|
|
147
147
|
no_return: 'error',
|
|
148
148
|
shadow_builtin: 'error',
|
|
149
149
|
dynamic_doc: 'error',
|
|
150
150
|
loop_optimization: 'warn',
|
|
151
|
-
type_check: 'warn',
|
|
152
151
|
format_indent: 'warn',
|
|
153
152
|
redundant_if: 'error',
|
|
154
153
|
module_registration: 'error',
|
package/dist/rules.js
CHANGED
|
@@ -97,7 +97,7 @@ exports.RULES = [
|
|
|
97
97
|
category: '风格',
|
|
98
98
|
},
|
|
99
99
|
{ name: 'line_length', defaultSeverity: 'info', description: '检查行长度是否超过限制', category: '风格' },
|
|
100
|
-
{ name: 'long_function_call', defaultSeverity: '
|
|
100
|
+
{ name: 'long_function_call', defaultSeverity: 'off', description: '检测单行参数过多的函数调用', category: '风格' },
|
|
101
101
|
{
|
|
102
102
|
name: 'loop_optimization',
|
|
103
103
|
defaultSeverity: 'info',
|
|
@@ -192,7 +192,6 @@ exports.RULES = [
|
|
|
192
192
|
},
|
|
193
193
|
{ name: 'trailing_paren', defaultSeverity: 'warn', description: '检测多余闭合括号', category: '语法' },
|
|
194
194
|
{ name: 'trailing_whitespace', defaultSeverity: 'info', description: '检测行尾多余空格', category: '风格' },
|
|
195
|
-
{ name: 'type_check', defaultSeverity: 'info', description: '检测 getvar 结果未做类型检查', category: '最佳实践' },
|
|
196
195
|
{
|
|
197
196
|
name: 'undeclared_setq',
|
|
198
197
|
defaultSeverity: 'warn',
|
package/dist/runner.js
CHANGED
|
@@ -78,7 +78,6 @@ const no_return_1 = require("./checks/no-return");
|
|
|
78
78
|
const shadow_builtin_1 = require("./checks/shadow-builtin");
|
|
79
79
|
const dynamic_doc_1 = require("./checks/dynamic-doc");
|
|
80
80
|
const loop_optimization_1 = require("./checks/loop-optimization");
|
|
81
|
-
const type_check_1 = require("./checks/type-check");
|
|
82
81
|
const redundant_if_1 = require("./checks/redundant-if");
|
|
83
82
|
const undeclared_setq_1 = require("./checks/undeclared-setq");
|
|
84
83
|
const format_indent_1 = require("./checks/format-indent");
|
|
@@ -157,7 +156,6 @@ function runChecks(content, file, config) {
|
|
|
157
156
|
addIfEnabled('shadow_builtin', () => (0, shadow_builtin_1.checkShadowBuiltin)(content, file));
|
|
158
157
|
addIfEnabled('dynamic_doc', () => (0, dynamic_doc_1.checkDynamicDoc)(content, file));
|
|
159
158
|
addIfEnabled('loop_optimization', () => (0, loop_optimization_1.checkLoopOptimization)(content, file));
|
|
160
|
-
addIfEnabled('type_check', () => (0, type_check_1.checkTypeCheck)(content, file));
|
|
161
159
|
addIfEnabled('redundant_if', () => (0, redundant_if_1.checkRedundantIf)(content, file));
|
|
162
160
|
addIfEnabled('undeclared_setq', () => (0, undeclared_setq_1.checkUndeclaredSetq)(content, file));
|
|
163
161
|
addIfEnabled('format_indent', () => (0, format_indent_1.checkFormatIndent)(content, file, config.line_length.tab_width));
|
package/dist/validate.js
CHANGED
package/dist/visitor-runner.js
CHANGED
|
@@ -70,7 +70,7 @@ function runChecksWithVisitor(ast, file, config, disableMap) {
|
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
72
72
|
function getCondKey(node) {
|
|
73
|
-
if (node.type === 'symbol')
|
|
73
|
+
if (node.type === 'symbol' || node.type === 'keyword')
|
|
74
74
|
return node.name || '';
|
|
75
75
|
if (node.type === 'string' || node.type === 'number')
|
|
76
76
|
return String(node.value);
|