- 新增模型目录占位文件与翻译类型拆分 - 调整路由配置与桌面端窗口初始化 - 移除多处冗余图表配置项 - 重构右侧面板注册表与三栏布局组件 - 添加智能AppBar、拖拽书签等新功能组件 - 优化安卓编译配置与多平台插件注册 - 新增翻译覆盖率测试与共享组件 - 格式化代码与修复静态分析警告
99 lines
2.9 KiB
YAML
99 lines
2.9 KiB
YAML
# ============================================================
|
||
# 闲言APP — 代码分析配置
|
||
# 创建时间: 2026-04-20
|
||
# 更新时间: 2026-05-29
|
||
# 作用: Dart/Flutter 静态分析规则
|
||
# 上次更新: 新增deprecated_member_use_from_same_package配置,翻译模块@Deprecated兼容
|
||
# ============================================================
|
||
|
||
# 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
|
||
# 同包内@Deprecated使用不报警(翻译模块兼容桥接)
|
||
deprecated_member_use_from_same_package: ignore
|
||
|
||
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
|