Files
xianyan/analysis_options.yaml
Developer 10df6b705c 同步
2026-06-02 03:52:54 +08:00

97 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# 闲言APP — 代码分析配置
# 创建时间: 2026-04-20
# 更新时间: 2026-06-02
# 作用: Dart/Flutter 静态分析规则
# 上次更新: 移除custom_lint插件(分析器崩溃)保留riverpod_lint
# ============================================================
# riverpod_lint 3.x 不再提供 analysis_options.yaml 供外部 include
# 其 lint 规则通过 custom_lint 插件机制提供
# 注意: custom_lint 0.8.x + xianyan_lint 导致分析器崩溃,已移除
analyzer:
# 排除生成的代码
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
- "**/*.config.dart"
- "lib/gen/**"
- "packages/**"
- "docs/**"
- "docs/toolsapi/**"
- "**/*.md"
- "Scripts/**"
- "**/*.php"
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