<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: huang lizhuo</title>
    <description>The latest articles on DEV Community by huang lizhuo (@huang_lizhuo).</description>
    <link>https://dev.to/huang_lizhuo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4152512%2F283744b4-ffcb-4ddf-a619-9cfcf23472ce.png</url>
      <title>DEV Community: huang lizhuo</title>
      <link>https://dev.to/huang_lizhuo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/huang_lizhuo"/>
    <language>en</language>
    <item>
      <title>Almost half of React's code is tests: what a SLOC counter shows that GitHub hides</title>
      <dc:creator>huang lizhuo</dc:creator>
      <pubDate>Wed, 30 Sep 2026 14:30:21 +0000</pubDate>
      <link>https://dev.to/huang_lizhuo/almost-half-of-reacts-code-is-tests-what-a-sloc-counter-shows-that-github-hides-4ah5</link>
      <guid>https://dev.to/huang_lizhuo/almost-half-of-reacts-code-is-tests-what-a-sloc-counter-shows-that-github-hides-4ah5</guid>
      <description>&lt;p&gt;GitHub's repository sidebar shows language percentages. It never shows line counts. That always bothered me: is this dependency I'm about to adopt a tidy 2,000 lines or a 200,000-line monolith? The language bar says JavaScript 58%, TypeScript 42%, and nothing about how much of anything there is.&lt;/p&gt;

&lt;p&gt;So I built &lt;a href="https://octocounts.com/" rel="noopener noreferrer"&gt;OctoCounts&lt;/a&gt;. Paste any public GitHub repository URL and it downloads the source archive, runs &lt;a href="https://github.com/XAMPPRocky/tokei" rel="noopener noreferrer"&gt;tokei&lt;/a&gt;, and gives you files, total lines, code, comments, blanks, and per-language totals. No clone, no sign-up, free. Any branch, tag, or commit SHA, with results pinned to the exact commit and cached, so repeat views are instant.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it found when I pointed it at React
&lt;/h2&gt;

&lt;p&gt;The default count for facebook/react at the time of writing: &lt;strong&gt;696,459 code lines across 6,927 files in 14 languages&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Then OctoCounts' analysis options kick in. Exclude tests and the number collapses:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Repository&lt;/th&gt;
&lt;th&gt;Default code lines&lt;/th&gt;
&lt;th&gt;Exclude tests&lt;/th&gt;
&lt;th&gt;Delta&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;facebook/react&lt;/td&gt;
&lt;td&gt;696,459&lt;/td&gt;
&lt;td&gt;364,248&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−47.7%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;vitejs/vite&lt;/td&gt;
&lt;td&gt;112,297&lt;/td&gt;
&lt;td&gt;82,439&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−26.6%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Almost half of React's code is tests. For Vite it's over a quarter. Exclude docs and generated files, and the deltas are close to zero (0% and −1.3% for docs; 0% for generated in both), which says the interesting weight in these repos lives in tests, not in docs or vendored output.&lt;/p&gt;

&lt;p&gt;There is a practical point hiding in that table: &lt;strong&gt;any SLOC comparison that mixes test-inclusive and test-exclusive counts is not a valid comparison.&lt;/strong&gt; If one tool reports 696K and another reports 364K for the same repo at the same commit, both are right and the comparison is still wrong. That's why OctoCounts pins every report to a commit SHA and shows which configuration produced it. I wrote up the pilot (two repos, four configurations each, commit-pinned) at &lt;a href="https://octocounts.com/research" rel="noopener noreferrer"&gt;octocounts.com/research&lt;/a&gt;, dataset included.&lt;/p&gt;

&lt;h2&gt;
  
  
  What else comes with the count
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Permanent report pages&lt;/strong&gt; for every repo, e.g. &lt;a href="https://octocounts.com/github/facebook/react" rel="noopener noreferrer"&gt;octocounts.com/github/facebook/react&lt;/a&gt;, exportable as text, JSON, or a shareable PNG card&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live README badges&lt;/strong&gt;: &lt;code&gt;[![SLOC](https://api.octocounts.com/badge/:owner/:repo)](https://octocounts.com/github/:owner/:repo)&lt;/code&gt;, with per-language variants&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compare pages&lt;/strong&gt; for ~90 curated pairs: &lt;a href="https://octocounts.com/compare/react-vs-vue" rel="noopener noreferrer"&gt;React vs Vue&lt;/a&gt;, Rust vs Go, Electron vs Tauri, plus a tool to compare any two repos or two refs of one repo&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A browser extension&lt;/strong&gt; (Chrome, Edge, Firefox) that puts the counts directly in GitHub's sidebar, next to the language bar that started all this&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An API and an MCP server&lt;/strong&gt;, so agents and developer tools can pull the same reports&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A CLI&lt;/strong&gt;: &lt;code&gt;npx octocounts https://github.com/owner/repo --json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A GitHub Action&lt;/strong&gt; that comments SLOC changes on pull requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is cached by owner + repo + commit + engine version, which is what makes the badges and the API cheap to serve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Paste your own repository into &lt;a href="https://octocounts.com/" rel="noopener noreferrer"&gt;octocounts.com&lt;/a&gt; and see what your numbers say. Mine came out at 43,192 code lines across 180 files in 12 languages (tests, docs, and generated excluded), Rust on top at 31.2%, which is a satisfying shape for a line counter that runs on tokei.&lt;/p&gt;

&lt;p&gt;It's free and open source (MIT). Feedback welcome, especially on which filters would make the comparisons you care about valid.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>github</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
