How to remove incorrect TypeScript from your language stats in Codeberg/GitHub

Post Reply
User avatar
Wuzzy
Member
Posts: 5100
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

How to remove incorrect TypeScript from your language stats in Codeberg/GitHub

by Wuzzy » Post

Problem
If you host your Luanti games on Codeberg, GitHub or any Forgejo-powered website, you might have noticed an annoying oddity on your repo page: A weirdly large percentage of the programming language stats on the Codeberg or GitHub website is oddly marked as "TypeScript", although you didn't use TypeScript code anywhere. For example, the website might claim your repos is 80% Lua, 20% TypeScript.

I recently figured out why. Apparently these sites detect *.mts files as TypeScript. In Luanti, these are of course the Minetest Schematic files, not TypeScript.

Solution

If TypeScript shows up in your language stats, add the file .gitattributes to your repository (if it does not exist already) and write this line:

Code: Select all

*.mts linguist-detectable=false
Save, commit and push your changes, then TypeScript should be gone from the stats.

(See the Forgejo documentation (for Codeberg) or GitHub Linguist documentation (for GitHub) for an explanation on why this works.)

Example

Check out the Lazarr! repo in your browser: https://codeberg.org/Wuzzy/Lazarr
The language stats (the colored bar) should not mention TypeScript.

Skivling
Member
Posts: 22
Joined: Sat Mar 30, 2024 06:30
GitHub: Skivling
In-game: Skivling or Skiv
Location: Aotearoa New Zealand
Contact:

Re: How to remove incorrect TypeScript from your language stats in Codeberg/GitHub

by Skivling » Post

I never looked at the language stats or noticed this, but the git attribute addition works perfectly. Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest