主要变更: 1. 新增多风格音效资源与管理文档 2. 修复翻译服务空响应处理与Dio日志异常捕获 3. 完善Web端平台适配与路径获取Stub 4. 优化设备配对与文件传输功能 5. 新增角色命名常量与摇一摇检测器 6. 修复Riverpod dispose与鸿蒙导航路由 7. 新增每日通知服务与流体着色器 8. 优化备份服务与数据管理页面 9. 新增隐私设置附近设备发现选项 10. 重构诗词提供者支持历史记录 11. 完善桌面端构建配置与开发脚本 12. 清理旧版工具部署脚本
97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
# ============================================================
|
|
# 闲言APP — 代码分析配置
|
|
# 创建时间: 2026-04-20
|
|
# 更新时间: 2026-04-20
|
|
# 作用: Dart/Flutter 静态分析规则
|
|
# 上次更新: Phase 0 配置
|
|
# ============================================================
|
|
|
|
# riverpod_lint 3.x 不再提供 analysis_options.yaml 供外部 include
|
|
# 其 lint 规则通过 custom_lint 插件机制提供(见下方 plugins 配置)
|
|
# 旧版 2.x 的 include 方式已废弃,无需启用
|
|
|
|
analyzer:
|
|
# 排除生成的代码
|
|
exclude:
|
|
- "**/*.g.dart"
|
|
- "**/*.freezed.dart"
|
|
- "**/*.config.dart"
|
|
- "lib/gen/**"
|
|
- "packages/**"
|
|
- "docs/**"
|
|
- "docs/toolsapi/**"
|
|
- "**/*.md"
|
|
- "Scripts/**"
|
|
- "**/*.php"
|
|
plugins:
|
|
- custom_lint
|
|
|
|
errors:
|
|
# 自由化代码的警告降级
|
|
invalid_annotation_target: ignore
|
|
# 未使用的导入视为警告
|
|
unused_import: warning
|
|
# 缺少返回类型
|
|
missing_return: error
|
|
|
|
language:
|
|
strict-casts: true
|
|
strict-inference: true
|
|
strict-raw-types: true
|
|
|
|
linter:
|
|
rules:
|
|
# ---- 代码风格 ----
|
|
prefer_single_quotes: true
|
|
prefer_const_constructors: true
|
|
prefer_const_declarations: true
|
|
prefer_const_literals_to_create_immutables: true
|
|
prefer_final_fields: true
|
|
prefer_final_locals: true
|
|
prefer_final_in_for_each: true
|
|
|
|
# ---- 命名 ----
|
|
camel_case_types: true
|
|
camel_case_extensions: true
|
|
non_constant_identifier_names: true
|
|
constant_identifier_names: true
|
|
file_names: true
|
|
|
|
# ---- 代码质量 ----
|
|
avoid_print: true
|
|
avoid_empty_else: true
|
|
avoid_unnecessary_containers: true
|
|
avoid_redundant_argument_values: true
|
|
avoid_return_types_on_setters: true
|
|
avoid_types_as_parameter_names: true
|
|
empty_constructor_bodies: true
|
|
empty_catches: true
|
|
no_duplicate_case_values: true
|
|
no_leading_underscores_for_local_identifiers: true
|
|
null_check_on_nullable_type_parameter: true
|
|
prefer_is_empty: true
|
|
prefer_is_not_empty: true
|
|
prefer_is_not_operator: true
|
|
prefer_null_aware_operators: true
|
|
prefer_typing_uninitialized_variables: true
|
|
unnecessary_const: true
|
|
unnecessary_new: true
|
|
unnecessary_null_in_if_null_operators: true
|
|
unnecessary_overrides: true
|
|
unnecessary_parenthesis: true
|
|
unnecessary_string_escapes: true
|
|
unnecessary_string_interpolations: true
|
|
unnecessary_this: true
|
|
use_key_in_widget_constructors: true
|
|
sized_box_for_whitespace: true
|
|
use_build_context_synchronously: true
|
|
avoid_dynamic_calls: true
|
|
|
|
# ---- Flutter 特定 ----
|
|
use_full_hex_values_for_flutter_colors: true
|
|
prefer_void_to_null: true
|
|
|
|
# ---- 允许的例外 ----
|
|
# 代码行宽不严格限制 (依赖 formatter)
|
|
# lines_longer_than_80_chars: false
|