-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add go.mod heuristics #6996
Add go.mod heuristics #6996
Conversation
This won't work as A better solution would be to add linguist/lib/linguist/languages.yml Lines 2547 to 2557 in d190ad8
... though usage isn't anywhere near popular enough for inclusion right now. Until then, peeps will need to use an override to force the langauge. |
What are the criteria for being popular enough? For the record, almost every Golang repo uses the
@lildude , thank you for your suggestion! Most of the current As far as I understand, the following code: linguist/lib/linguist/heuristics.rb Line 123 in a0a6d59
... says that heuristics are applied based on a filename suffix, and they do not depend on the extensions listed in Could you please elaborate more on how are |
See #5756, also referenced from the CONTRIBUTING.md file.
Indeed. And Linguist already has support for
That's only in the search results, which uses a different internal library to detect the language. This internal library happens to feed off Linguist, but not perfectly as it's not a 1:1 match in terms of functionality. The actual files are already correctly identified by Linguist and the syntax highlighter applies the correct syntax highlighting too. We can confirm this from the first result in your search results: https://github.com/jmoiron/sqlx. This is what the search results show - wrong language and wrong syntax highlighting: However if you view the file, you get the correct syntax highlighting: And if we use Linguist to analyse it, we get the correct language: ➜ github-linguist sqlx/
99.74% 220442 Go
0.26% 583 Makefile
➜ github-linguist sqlx/go.mod
sqlx/go.mod: 9 lines (7 sloc)
type: Text
mime type: text/plain
language: Go Module
➜ Which aligns with the language stats shown in the sidebar of the repo: AMPL is considered a detectable language by default in Linguist so if Linguist had incorrectly determined the language as AMPL, it would appear in the results above. Unfortunately, no amount of tweaking Linguist is going to resolve this issue with what Search is showing. The team that handles Search will need to address this incorrect behaviour. Please use the "Contact" link at the bottom of the page showing the wrong search results and log a support ticket. The issue will get routed to the correct team to address. |
058459f
to
1ec5ead
Compare
@lildude , thank you for clarifying that! It looks like my changes are not required, and the problem is on the GitHub side. Should I report the problem somewhere? |
Yes. From my previous comment 😉:
|
For the record, here is a bug report: https://github.com/orgs/community/discussions/136097 |
Description
Checklist:
I am fixing a misclassified language
As for the samples I've provided, they are modified copies of existing samples in the repository.