-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ template header detected as C #1032
Comments
A quick check through the sources shows that the heuristic for C vs C++ vs Objective-C is extremely bad and not really a heuristic at all.. see https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb#L41 A better check for a C++ header is to check for the inclusion of any STL headers, followed by a check for the existence of constructs like "template[ ]*<" within the header. I'm sure there's also some regex that can be used to detect a C++ class in place of anything Obj-C has. Checking for the use of template constructs would have detected ThreadedQueue here. |
Feel free to improve it in a pull request :) |
The problem I've got is I don't know Ruby nor do I know how to write Regex's for it.. otherwise I would. Some pointers so I can? |
There is an example of a regex in the heuristics file, at the end. |
Pull request sent - see request #1036 |
I was looking at the breakdown of code in one of my repositories and noticed headers that contain purely C++ code being classified as C instead. One example header is linked below. A template class is not possible C.
https://github.com/DX-MON/IRCBot/blob/a344fa80e4d93a7eb7aa8b64983e5bb5041cfb07/ThreadedQueue.h
The text was updated successfully, but these errors were encountered: