From be7f9fe966db19d8149cb83fa01f08a9ba0ef956 Mon Sep 17 00:00:00 2001 From: Virgil Date: Wed, 1 Apr 2026 07:19:43 +0000 Subject: [PATCH] Improve lint tool inventory output --- cmd/core-lint/main.go | 6 +++++- cmd/core-lint/main_test.go | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/cmd/core-lint/main.go b/cmd/core-lint/main.go index 9ac2f94..9055992 100644 --- a/cmd/core-lint/main.go +++ b/cmd/core-lint/main.go @@ -159,7 +159,11 @@ func newToolsCommand(commandName string, summary string) *cli.Command { if tool.Available { status = "available" } - fmt.Fprintf(command.OutOrStdout(), "%-14s [%-11s] %s\n", tool.Name, tool.Category, status) + line := fmt.Sprintf("%-14s [%-11s] %s langs=%s", tool.Name, tool.Category, status, strings.Join(tool.Languages, ",")) + if tool.Entitlement != "" { + line += " entitlement=" + tool.Entitlement + } + fmt.Fprintln(command.OutOrStdout(), line) } return nil case "json": diff --git a/cmd/core-lint/main_test.go b/cmd/core-lint/main_test.go index 48f3271..127cc80 100644 --- a/cmd/core-lint/main_test.go +++ b/cmd/core-lint/main_test.go @@ -105,6 +105,27 @@ func TestCLI_Init_WritesConfig(t *testing.T) { assert.Contains(t, string(content), "fail_on: error") } +func TestCLI_Tools_TextIncludesMetadata(t *testing.T) { + buildCLI(t) + + binDir := t.TempDir() + fakeToolPath := filepath.Join(binDir, "gosec") + require.NoError(t, os.WriteFile(fakeToolPath, []byte("#!/bin/sh\nexit 0\n"), 0o755)) + t.Setenv("PATH", binDir+string(os.PathListSeparator)+os.Getenv("PATH")) + + command := exec.Command(buildCLI(t), "tools", "--lang", "go") + command.Dir = t.TempDir() + command.Env = os.Environ() + + output, err := command.CombinedOutput() + require.NoError(t, err, string(output)) + + text := string(output) + assert.Contains(t, text, "gosec") + assert.Contains(t, text, "langs=go") + assert.Contains(t, text, "entitlement=lint.security") +} + func TestCLI_HookInstallRemove(t *testing.T) { if _, err := exec.LookPath("git"); err != nil { t.Skip("git not available")