GitHub搜索允许按语言过滤存储库。如何将存储库设置为特定语言?
GitHub搜索允许按语言过滤存储库。如何将存储库设置为特定语言?
*.cls linguist-language=openedge-abl
(以及*.p
,*.i
,*.w
)->完成。 - Tw Bert这纯粹是从代码内容中推断出来的。
请注意,我们计算每种语言文件的总字节数(我们检查扩展名)来确定百分比。
这意味着,如果您看到您的项目被报告为JavaScript,但您发誓使用Ruby,则可能在某个地方有一个比您的Ruby代码大的JS库。
如“GitHub更改错误的仓库语言”中所述,您可以添加一个.gitattributes
文件,其中您可以:
ignore part of your project (not considered for language detection)
static/* linguist-vendored
consider part of your project as documentation:
docs/* linguist-documentation
indicate some files with specific extension (for instance *.rb
) should be considered a specific language:
*.rb linguist-language=Java
.gitattributes
的文件。如果你想要排除 CSS 的语言统计数据,请在文件中写入类似以下的内容。
client/stylesheets/* linguist-vendored
这将隐藏 client/stylesheets/
中的所有文件,从语言统计数据中排除它们。在我的情况下,这些是 .css 文件。虽然有些粗糙,但我使用了这个.gitattributes文件:
* linguist-vendored
*.js linguist-vendored=false
它说要忽略除了.js以外的所有文件,所以JavaScript成为了唯一可能的语言。我的项目https://github.com/aim12340/jQuery-Before-Ready被列为HTML,这使它变成了JavaScript。
正如VonC在评论中提到的,您可以将库放在“vendors”或“thirdparty”下,这样文件就不会被linguist分析,该工具是GitHub用于分析代码中语言的工具。
# Vendored dependencies
- third[-_]?party/
- 3rd[-_]?party/
- vendors?/
- extern(al)?/
后来,他们添加了更多的文件夹名称。
*.java linguist-detectable=true
*.js linguist-detectable=false
*.html linguist-detectable=false
*.xml linguist-detectable=false
将代码库中的代码文件名重命名并添加扩展名。
例如: