Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix: hide config languages from language usage (#623)
Yui(ゆい)ce9169f4cc6a
diff --git a/packages/ui/__tests__/dashboard/language-donut.test.tsx b/packages/ui/__tests__/dashboard/language-donut.test.tsxnew file mode 100644index 000000000..123b93a90--- /dev/null+++ b/packages/ui/__tests__/dashboard/language-donut.test.tsx@@ -0,0 +1,35 @@+import { describe, expect, it } from "vitest";+import { render, screen } from "@testing-library/react";+import { LanguageDonut } from "../../src/dashboard/language-donut.js";++describe("LanguageDonut", () => {+ it("hides config file formats from the visible language usage", () => {+ render(+ <LanguageDonut+ distribution={{+ Python: 7,+ TypeScript: 3,+ JSON: 5,+ yaml: 4,+ TOML: 1,+ }}+ />,+ );++ expect(screen.getByText("Python")).toBeInTheDocument();+ expect(screen.getByText("TypeScript")).toBeInTheDocument();+ expect(screen.queryByText("JSON")).not.toBeInTheDocument();+ expect(screen.queryByText("yaml")).not.toBeInTheDocument();+ expect(screen.queryByText("TOML")).not.toBeInTheDocument();+ expect(screen.getByText("70%")).toBeInTheDocument();+ expect(screen.getByText("30%")).toBeInTheDocument();+ });++ it("renders nothing when only config file formats are present", () => {+ const { container } = render(+ <LanguageDonut distribution={{ json: 2, YAML: 1, toml: 1 }} />,+ );++ expect(container).toBeEmptyDOMElement();+ });+});diff --git a/packages/ui/src/dashboard/language-donut.tsx b/packages/ui/src/dashboard/language-donut.tsxindex 02382eb4b..953f9041e 100644--- a/packages/ui/src/dashboard/language-donut.tsx+++ b/packages/ui/src/dashboard/language-donut.tsx@@ -16,10 +16,16 @@ const LANG_COLORS: Record<string, string> = {config: "var(--color-lang-config)",};+const HIDDEN_LANGUAGE_USAGE_FORMATS = new Set(["json", "yaml", "toml"]);+function getLangColor(lang: string): string {return LANG_COLORS[lang.toLowerCase()] ?? "var(--color-lang-other)";}+function shouldShowLanguageUsage(name: string): boolean {+ return !HIDDEN_LANGUAGE_USAGE_FORMATS.has(name.trim().toLowerCase());+}+interface LanguageDonutProps {/** Map of language → file count */distribution: Record<string, number>;@@ -29,6 +35,7 @@ interface LanguageDonutProps {export function LanguageDonut({ distribution, viewAllHref }: LanguageDonutProps) {const entries = Object.entries(distribution)+ .filter(([name]) => shouldShowLanguageUsage(name)).map(([name, value]) => ({ name, value })).sort((a, b) => b.value - a.value);