codman: Move file line counts to kLOC column

File metrics do not align with directory columns, making it hard to
compare them visually. Align file output with directory columns by:
- Skipping the Files, Used, and %Used columns (leave empty)
- Showing percentage active in the %Code column
- Showing total lines (in kLOC) in the kLOC column
- Showing active lines (in kLOC) in the Used column

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-08 17:08:36 -07:00
parent e0543235e1
commit 34cdaeafdb

View File

@@ -394,8 +394,11 @@ def print_dir_stats(dir_stats, file_results, by_subdirs, show_files,
if file_results:
# Show line-level details
pct_active = percent(info['active'], info['total'])
print(f" {filename:<38} {info['total']:>7} "
f"{info['active']:>7} {pct_active:>6.1f}")
# Align with directory format: skip Files/Used columns,
# show %code, then lines in kLOC column, active in Used column
print(f" {filename:<38} {'':>7} {'':>7} {'':>6} "
f"{pct_active:>6.1f} {klocs(info['total']):>8} "
f"{klocs(info['active']):>7}")
else:
# Show file-level only
print(f" {filename:<38} {info['total']:>7} lines")