github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.34k stars 4.27k forks source link

Linguist Languages Not Showing Correctly #7116

Closed derekvmcintire closed 3 weeks ago

derekvmcintire commented 3 weeks ago

My Repository: https://github.com/derekvmcintire/acs-next-api

Steps I have taken:

  1. I went through the troubleshooting document which told me to click the different languages to see a list of files that were detected as said language:

    • Clicking on HTML shows "Your search did not match any code" (expected, there are no html files)
    • Clicking on Typescript shows 31 files found
    • Clicking on JavaScript shows 18 files found My repo also contains a small number of other file types that I don't see listed, such as:
    • .mjs
    • .tsx
    • .css
    • .json
  2. I tried adding a .gitattributes file with the following configuration:

.js linguist-language=JavaScript .mjs linguist-language=JavaScript .ts linguist-language=TypeScript .html linguist-language=HTML

Thanks!

lildude commented 3 weeks ago

You've not stated what you believe is wrong with how things are showing. What are you expecting to see?

From a quick look, everything looks good to me.

Clicking on HTML shows "Your search did not match any code" (expected, there are no html files)

There's actually one file, prisma/docs/index.html, and it's massive at 1.6MB. This is too big for the search to index (as documented), hence you get no results.

If you don't want this to count, you'll need to use an override. Something like:

prisma/docs/**/* linguist-documentation

... will mark the directory as documentation and Linguist won't count the contents.

As for the rest, for a start you don't need the override as the behaviour you're setting is the default. This is the analysis if I remove your .gitattributes:

➜ github-linguist acs-next-api/
96.61%  1616326    HTML
1.82%   30470      TypeScript
1.55%   25852      JavaScript
0.02%   368        CSS
➜

... which will give you:

➜ github-linguist .
53.75%  30470      TypeScript
45.60%  25852      JavaScript
0.65%   368        CSS
➜
  • My repo also contains a small number of other file types that I don't see listed, such as:

  • .mjs

These will be included in the JavaScript count

  • .tsx

This will be included in the TypeScript count

  • .css

There is one file and it's insignificantly small in terms of bytes of code for the whole repo so the sidebar doesn't show it.

  • .json

JSON files are data and not included in counts by default. You'll need to implement an override if you want this to count.

So all in all, things are behaving as expected. What are you expecting to see?