Loourr
Loourr

Reputation: 5125

Github incorrectly recognizes programming language used in the project

So I have a git repository that I wrote in C++, but github insists that I'm using D. Why is this and is there someway to correct it?

Upvotes: 23

Views: 4416

Answers (2)

Andriy Makukha
Andriy Makukha

Reputation: 8304

You could create a file .gitattributes to set GitHub's Linguist overrides.

To set your C++ files to be detected as C++ by extension:

*.h linguist-language=C++
*.cpp linguist-language=C++

To ignore generated files and don't show them in diffs:

generated/*.d linguist-generated=true

Also, you can mark some files as undetectable, if the language is not on the known languages list:

*.t linguist-detectable=false

Upvotes: 5

sasha.sochka
sasha.sochka

Reputation: 14715

Github uses it's own language parsing module and sometimes (actually often) it makes faults. Just write more code to make it easier for parser to choose what your main language is and after some time github will get it right.

In this particular case code parser is fooled by your files in STMC-C/Assignments/a* dirs with .d extension. That's an extension for D sources. The number of this sources dominated in your project so github decided that the main programming language used is D.

edit: Just found this public repo (github language detector) - it has some explanations of the system.

Upvotes: 13

Related Questions