From 7dec2f8dc8ffd5a7041ac66a0f8bc927f224cd85 Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:32:13 +0900 Subject: [PATCH] fix: add nolint:gosmopolitan for CJK test fixtures, fix gci formatting Co-Authored-By: Claude Opus 4.6 (1M context) --- pkg/channels/telegram/render_telegram_test.go | 4 ++-- pkg/channels/telegram/table_render_test.go | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pkg/channels/telegram/render_telegram_test.go b/pkg/channels/telegram/render_telegram_test.go index 7cccc6dad..f660fab75 100644 --- a/pkg/channels/telegram/render_telegram_test.go +++ b/pkg/channels/telegram/render_telegram_test.go @@ -280,9 +280,9 @@ func TestRender_Table_EmptyCells(t *testing.T) { } func TestRender_Table_CJK(t *testing.T) { - input := "| 名前 | バージョン |\n|---|---|\n| Go | 1.22 |" + input := "| 名前 | バージョン |\n|---|---|\n| Go | 1.22 |" //nolint:gosmopolitan htmlGot := renderHTML(input) - assert.Contains(t, htmlGot, "名前") + assert.Contains(t, htmlGot, "名前") //nolint:gosmopolitan assert.Contains(t, htmlGot, "Go") } diff --git a/pkg/channels/telegram/table_render_test.go b/pkg/channels/telegram/table_render_test.go index 79046f473..dbd886af0 100644 --- a/pkg/channels/telegram/table_render_test.go +++ b/pkg/channels/telegram/table_render_test.go @@ -9,15 +9,15 @@ import ( func TestRuneWidth(t *testing.T) { assert.Equal(t, 1, runeWidth('a')) assert.Equal(t, 1, runeWidth('1')) - assert.Equal(t, 2, runeWidth('名')) - assert.Equal(t, 2, runeWidth('ア')) - assert.Equal(t, 2, runeWidth('あ')) + assert.Equal(t, 2, runeWidth('名')) //nolint:gosmopolitan + assert.Equal(t, 2, runeWidth('ア')) //nolint:gosmopolitan + assert.Equal(t, 2, runeWidth('あ')) //nolint:gosmopolitan } func TestStringWidth(t *testing.T) { assert.Equal(t, 5, stringWidth("hello")) - assert.Equal(t, 4, stringWidth("名前")) // 2+2 - assert.Equal(t, 4, stringWidth("Go言")) // 1+1+2 + assert.Equal(t, 4, stringWidth("名前")) //nolint:gosmopolitan // CJK width test + assert.Equal(t, 4, stringWidth("Go言")) //nolint:gosmopolitan // CJK width test } func TestRenderTableMono(t *testing.T) { @@ -56,16 +56,14 @@ func TestRenderTableMono_SingleColumn(t *testing.T) { func TestRenderTableMono_CJK(t *testing.T) { td := tableData{ - headers: []string{"名前", "バージョン"}, + headers: []string{"名前", "バージョン"}, //nolint:gosmopolitan rows: [][]string{ {"Go", "1.22"}, }, } got := renderTableMono(td) - // "名前" width=4, "バージョン" width=10 - // "Go" width=2, "1.22" width=4 - expected := "名前 | バージョン\n" + + expected := "名前 | バージョン\n" + //nolint:gosmopolitan "-----+-----------\n" + "Go | 1.22 " assert.Equal(t, expected, got) @@ -142,7 +140,7 @@ func TestTableWidth(t *testing.T) { func TestTableWidth_CJK(t *testing.T) { td := tableData{ - headers: []string{"名前", "値"}, + headers: []string{"名前", "値"}, //nolint:gosmopolitan rows: [][]string{{"Go", "ok"}}, } // "名前"=4, "値"=2 → max col widths: 4, 2 → total=4+2+3=9