Linguist: Include submodules in repo language calculations

Created on 18 Sep 2016  路  11Comments  路  Source: github/linguist

When calculating the primary language of a repo or the percentages, I think there should be an option somewhere to include submodules. For example, one of my projects is divided into frontend, backend, and client. Each of these is in its own repo, and I have a conglomerate repo containing everything as submodules. Because it contains only submodules, it doesn't show languages in the top bar, nor does it show a language where it's pinned to my profile.

For the simplest case, when all the submodules are also hosted on GitHub, this could be a fairly inexpensive calculation.

I understand that some people include external libraries as submodules, which is why I propose this as a configurable option in the repo.

Thoughts from anyone?

Most helpful comment

Thoughts from anyone?

I am sympathetic to this use case but I think it's pretty niche to be honest. In addition, we'd have to be really careful to make sure people didn't create repositories with nested submodules (i.e. A has submodule B, B has submodule C, C has submodule D etc..). I'm afraid I can't really imagine us doing this sorry so rather than leave the issue open I think we should close this as a wontfix

All 11 comments

Thoughts from anyone?

I am sympathetic to this use case but I think it's pretty niche to be honest. In addition, we'd have to be really careful to make sure people didn't create repositories with nested submodules (i.e. A has submodule B, B has submodule C, C has submodule D etc..). I'm afraid I can't really imagine us doing this sorry so rather than leave the issue open I think we should close this as a wontfix

Just stick a dummy file in there:

#!/usr/bin/env python
from subprocess import call

# Update Git submodules
call(["git", "submodule", "update"])

Both your submodules are already 100% Python, so having a 112-byte throwaway script will still give an accurate indication of your repo's content.

Also, 100% agreed with @arfon. Having submodules calculated in language stats has the potential to introduce a _lot_ of complications.

@arfon I don't think it's really too niche, lots of people have submodules even if their one repo isn't empty. But I guess I see your point

@Alhadis There are actually 3 submodules, one of which is HTML/CSS/JS (server/static)

If you guys feel like this is too niche, I respect that though.

For the simplest case, when all the submodules are also hosted on GitHub, this could be a fairly inexpensive calculation.

Exactly, which is why I believe at least this case should be implemented, as I don't see how this would introduce a lot of complications. You simply rely on what the GitHub API already reports as languages for the submodule paths and take that into account as a given fact.

BTW, this seems to be a duplicate of https://github.com/github/linguist/issues/1205.

You're right, it is a duplicate. Oops 馃槵

Why would we do this? I'de like to exclude submodule's language on my repository. written module ts -> dist gives js, whole repository telling that it's js. (*R*)

I'de like to exclude submodule's language on my repository.

@softmarshmallow This is already the case. Submodules are _never_ considered when assessing a repository's language statistics. If you're seeing unexpected languages, it's likely some other file(s) within your repo is being incorrectly detected. Feel free to open a new issue and we can help you identify the responsible files.

@lildude Hi, thanks. could you take a quick look? I think it's a bug. when i click js, no files will appear.
It was 100% ts, after adding submodule it got js.

https://github.com/bridgedxyz/assistant

Just to confirm the case. once confirmed, I'll open a new issue.

image

Can you please open a new issue so keep that discussion separate from this issue.

@lildude #5043 thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TimothyGu picture TimothyGu  路  5Comments

BnSalahFahmi picture BnSalahFahmi  路  3Comments

d4nyll picture d4nyll  路  3Comments

oliviertassinari picture oliviertassinari  路  5Comments

philiparvidsson picture philiparvidsson  路  4Comments