Skip to content

Commit e36a864

Browse files
committed
chore(swiftlint): 调整规则配置并放宽阈值
1 parent 1919d99 commit e36a864

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

‎.swiftlint.yml‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ disabled_rules:
2525
# 注意:line_length 是默认开启规则,不在 disabled_rules 中关闭,
2626
# 直接在下方 line_length: 配置块生效(置于 disabled_rules 会导致同名配置块被忽略)
2727
- force_try # 由 st_no_force_try_outside_markdown 精准限制,允许 STMarkdown 静态正则
28+
- notification_center_detachment # 生命周期中主动解绑是计时器/HUD的既有行为,不能限定在 deinit
2829
- missing_docs # 存量 882 个公开 API 缺文档,暂不纳入 --strict 门槛;文档补齐专项后再恢复 opt_in_rules
2930

3031
opt_in_rules:
@@ -43,13 +44,10 @@ opt_in_rules:
4344
- contains_over_filter_count
4445
- contains_over_first_not_nil
4546
- convenience_type
46-
- discouraged_optional_boolean # ★ 标记 Optional<Bool>;若确需三态语义,局部说明并豁免
4747
- redundant_objc_attribute # ★ 检查不必要的 @objc,与顶部注释“@objc 滥用”策略一致
4848
- fallthrough
4949
- fatal_error_message
5050
- flatmap_over_map_reduce
51-
- force_unwrapping # ★ 强解包警告(不直接 error,避免一次性失血)
52-
- implicitly_unwrapped_optional # ★ 隐式解包变量
5351
- joined_default_parameter
5452
- literal_expression_end_indentation
5553
- lower_acl_than_parent # ★ 子声明可见性高于父类型时报警
@@ -62,7 +60,6 @@ opt_in_rules:
6260
# === 公共基础库 Bug Prevention(第一批,低风险高价值)===
6361
- weak_delegate # ★ delegate 必须为 weak,否则循环引用
6462
- discarded_notification_center_observer # ★ block observer token 应被持有,便于按生命周期移除
65-
- private_subject # ★ Combine Subject 不应作为公开属性暴露
6663
- unhandled_throwing_task # ★ 显式处理 throwing Task 的错误或结果
6764
# 注:SwiftLint 无“公开类强制 final”规则(final_class 不存在);如需约束可改用
6865
# 架构评审/PR 模板,或 static_over_final_class(语义不同,未启用)。
@@ -81,8 +78,8 @@ analyzer_rules:
8178

8279
# === 规则参数化 ===
8380
line_length:
84-
warning: 220
85-
error: 300
81+
warning: 300
82+
error: 400
8683
ignores_urls: true
8784
ignores_function_declarations: true
8885
ignores_comments: true
@@ -92,7 +89,7 @@ function_body_length:
9289
error: 250
9390

9491
type_body_length:
95-
warning: 600
92+
warning: 750
9693
error: 1000
9794

9895
file_length:
@@ -101,9 +98,18 @@ file_length:
10198
ignore_comment_only_lines: true
10299

103100
cyclomatic_complexity:
104-
warning: 15
101+
warning: 22
105102
error: 30
106103

104+
function_parameter_count:
105+
warning: 8
106+
error: 9
107+
ignores_default_parameters: true
108+
109+
large_tuple:
110+
warning: 3
111+
error: 4
112+
107113
nesting:
108114
type_level:
109115
warning: 3

0 commit comments

Comments
 (0)