Address potential causes for "Your search did not match any code" issue when clicking a language in the stats bar (#6468)

* Update troubleshooting.md

Address potential causes for "Your search did not match any code" issue when clicking a language in the stats bar.

* Fix link

* Code search limitations + wording

* Shorten

* Add back link to go-enry
This commit is contained in:
Martin Leduc 2023-08-02 14:28:57 -04:00 коммит произвёл GitHub
Родитель e855ef2b6f
Коммит 5ffc61a32d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,15 @@ If the language stats bar is reporting a language that you don't expect:
Keep in mind that the repository language stats are only [updated when you push changes](how-linguist-works.md#how-linguist-works-on-githubcom), and the results are cached for the lifetime of your repository.
If you have not made any changes to your repository in a while, you may find pushing another change will correct the stats.
## When I click on a language present in the language stats bar, I get a message saying "Your search did not match any code"
There are a few reasons that could lead to this outcome:
1. If the repository implements an override via the `linguist-language` attribute, it won't be taken into account in GitHub's search results since GitHub Search relies on [go-enry](https://github.com/go-enry/go-enry) which doesn't support overrides at the moment ([More info](https://github.com/src-d/enry/issues/18)).
2. go-enry might not be using the latest version of Linguist which means that files could be detected differently in search compared to Linguist (see also the note at the end of [this section](#my-linguist-pr-has-been-merged-but-github-doesnt-reflect-my-changes)).
3. It could be that files are associated to a language that is part of a group. This means that they are counted as the parent language in the language stats bar, but as the actual language in search. For instance, a file ending with `.f90` is considered to be "Fortran" in the stats bar, but "Fortran Free Form" in search.
4. Finally, this can be caused by [code search limitations](https://docs.github.com/en/search-github/github-code-search/about-github-code-search#limitations) that are unrelated to Linguist.
## My C/C++/Objective-C `.h` header file is detected as the wrong language
Correctly detecting the language for the C-family `.h` header files is tough because Linguist detects the languages of files in isolation when analysing repositories and these header files, especially the smaller ones, can be used across all three languages without using any language-specific content.