Repository navigation
Expand file tree
/
Copy pathelvis.config
More file actions
53 lines (52 loc) · 2.39 KB
/
Copy pathelvis.config
File metadata and controls
53 lines (52 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%% imboy elvis 配置(elvis 5.x schema)
%% 真源:imboy/elvis.config(imboy 仓自维护,非三仓共享)
%% 关联:.claude/plans/quality-loop.md v1.3 T2.1 + T2.2
%% 工具:elvis 5.0.3(独立 escript / brew install elvis),erlfmt 1.x(独立)
%% 用法:cd imboy && elvis rock(v1.3 T2.2 落地后通过 make elvis 调用)
%%
%% Schema 变更(vs 旧版 1.x):
%% - 顶层去掉 {elvis, [...]} 包裹(5.x 直接用 proplist)
%% - 'dirs' + 'filter' 合并为 'files' 字段(glob list)
%% - 移除 'makefiles' / 'elvis_config' ruleset(5.x 已废弃)
%% - 移除指向不存在的 rebar.config 段(imboy 用 erlang.mk)
%%
%% Ruleset 策略(v1.3):
%% - erl_files 内置规则全开(含 max_line_length / no_deep_nesting / no_god_modules /
%% no_if_expression / dont_repeat_yourself / atom_naming_convention 等)
%% - 仅覆盖 2 条默认值:max_line_length 100→120,no_god_modules 25→30
%% - 其他保持 elvis_core 5.0.3 默认(no_deep_nesting level=4 与目标一致)
%% - hrl_files 默认值用于 include/*.hrl 头文件
%%
%% elvis 5.x 规则重命名(vs 旧版主计划 v1.0 中的命名):
%% line_length → max_line_length
%% god_modules → no_god_modules
%% nesting_level → no_deep_nesting
[
{config,
[
%% 1) src 根 + 一级子目录(src/api、src/logic、src/ds、src/repo、src/adm、src/lib)的 .erl
#{files => ["src/*.erl", "src/**/*.erl"],
ruleset => erl_files,
%% gpb 生成代码豁免(头注释 Automatically @generated):实测 91% 违规
%% (9446/10397)来自 imboy_pb.erl 的生成命名风格,不代表手写代码质量。
%% 豁免后真实水位 951 violations / 307 FAIL files(2026-08-23 实测)。
ignore => ["src/imboy_pb.erl"],
rules => [
{elvis_text_style, max_line_length, #{limit => 120, skip_comments => false, no_whitespace_after_limit => true}},
{elvis_style, no_god_modules, #{limit => 30}}
]
},
%% 2) include / src 下的 .hrl 头文件
#{files => ["include/*.hrl", "src/*.hrl", "src/**/*.hrl"],
ruleset => hrl_files,
rules => [
{elvis_text_style, max_line_length, #{limit => 120, skip_comments => false, no_whitespace_after_limit => true}}
]
}
]
},
%% 控制选项
{output_format, colors},
{warnings_as_errors, false},
{parallel, 4}
].