Skip to content

fix(localization): 拆分 check_keys.py main 降低认知复杂度 - #914

Merged
AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-12623-20261030T1330
Oct 31, 2026
Merged

AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-12623-20261030T1330

Conversation

@AlianBlank

@AlianBlank AlianBlank commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes GFX-1168
Closes #913

Summary by CodeRabbit

  • 重构
    • 整理了本地化检查工具的内部流程;现有检查内容、扫描规则、报告结果及成功或失败时的退出行为均保持不变。工作方式与此前一致。

SonarCloud python:S3776 在合并 #912 后的 main 上仍报 main()
认知复杂度超标(原 29,阈值 15)。将阶段编排拆为四个模块内
私有 helper:_parse_arguments、_report_placeholder_stage、
_report_callsite_stage、_exit_with_summary,main() 仅保留编排
与结构失败退出(sys.exit(2) 语义不变)。纯等价重构,门禁输出
与退出码逐字节一致。

Linear: GFX-1168
@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown

GFX-1168

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b0cdcef1-20b0-4c0b-9ece-b2cef589d93a
Commits

Reviewing files that changed from the base of the PR and between f45c620 and bbaeffd.

Files selected for processing: 1
  • GameFrameX.Localization/check_keys.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

check_keys.py 将参数解析、双语一致性检查、调用点扫描和退出汇总拆分为辅助函数。main() 按原顺序调用这些函数。原有参数、检查行为、报告内容和退出码保持不变。

Changes: 本地化键检查

Layer / File(s) Summary
检查阶段辅助函数
GameFrameX.Localization/check_keys.py
新增参数解析、占位符一致性检查、调用点扫描和退出汇总函数;保留原有参数、报告和退出行为。
main() 调用流程
GameFrameX.Localization/check_keys.py
main() 调用新增辅助函数,并保持检查顺序和失败消息传递不变。

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

Merge Risk: Minimal · up to bbaef

No actionable merge-blocking risk was identified. Run the normal quality checks before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题准确描述了主要变更:拆分 check_keys.py 的 main() 以降低认知复杂度。标题简洁、明确,并与重构目标一致。
Linked Issues check Passed PR #914 针对直接关联的 #913 修改了 GameFrameX.Localization/check_keys.py。变更将 CLI 参数解析、占位符阶段报告、调用点扫描报告和最终汇总退出拆分为独立函数,并保留 main() 的流程、原有参数、报告内容及退出码。摘要还确认没有导出或公共实体变更。该实现与降低五个 python:S3776 认知复杂度问题的目标一致。
Out of Scope Changes check Passed 变更仅涉及 GameFrameX.Localization/check_keys.py 的等价重构。摘要显示扫描条件、报告内容和检查流程未变。未发现与 #913 无关的功能、API 或文件变更。
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@AlianBlank
AlianBlank merged commit ca12a17 into main Oct 31, 2026
4 checks passed
@AlianBlank
AlianBlank deleted the feature/auto-server-source-worker-run-12623-20261030T1330 branch October 31, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P1 [Sonar] Fix GameFrameX.Localization/check_keys.py (1 issue)

1 participant