mirror of
https://github.com/docker/compose.git
synced 2026-09-01 07:11:06 +00:00
RootCommand (cognitive complexity 62) buried four independent concerns inside the PersistentPreRunE closure, where every branch costs double. Each moves to a named function: runParentPreRun (cobra doesn't chain the parent's PersistentPreRunE automatically), resolveAnsiMode (--ansi vs deprecated --no-ansi vs COMPOSE_ANSI), applyDisplayMode (ANSI + NO_COLOR + progress mode), normalizeProjectOptions (--workdir deprecation, env-file paths) and resolveMaxConcurrency (COMPOSE_PARALLEL_LIMIT vs --parallel). The prerun now reads as the sequence of those steps; RootCommand drops to complexity 22 and its FIXME suppression is gone. No behavior change: same errors, same deprecation warnings, same precedence rules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com> |
||
|---|---|---|
| .. | ||
| cmdtrace | ||
| compatibility | ||
| compose | ||
| display | ||
| formatter | ||
| prompt | ||
| main.go | ||