Hacker News new | ask | show | jobs
by flohofwoe 1593 days ago
Yes, github's language detection is definitely messed up, especially in the C language family. A while ago, a C or C++ source file would be detected as Objective-C if you had a variable called "id" (I think that's been fixed though).
2 comments

You can override it. I had to provide such an override so that my C++ module files would be reckognised as C++.

A .gitattributes file must be present with something like,

    *.ixx linguist-language=C++
More info here, https://github.com/github/linguist/blob/master/docs/override...
To add to that, Github reads Arduino code as C++.

I know it's not truly this simple, but if the file extension is ".ino", I feel like your detection algorithm should be free to use that as a massive indication it is Arduino code.

…but Arduino code IS c++ code. I don’t believe a distinction would make much sense.
They should throw AI at this problem.