Closed FPGA1988 closed 7 years ago
继续上述问题,经过资料查阅,Github是通过以下程序进行language的检查,点击链接以进入对应的repository : Linguist-GitHub代码语言检查工具 关于Linguist
This library is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs.
继续分析linguist的lib发现以下内容
Coq:
type: programming
extensions:
- ".coq"
- ".v"
ace_mode: text
language_id: 69
...
Verilog:
type: programming
color: "#b2b7f8"
extensions:
- ".v"
- ".veo"
ace_mode: verilog
codemirror_mode: verilog
codemirror_mime_type: text/x-verilog
language_id: 387
结果很明显了,两个都是有.v为后缀的文件,这个没办法改,只能看下怎么修改verilog才能不让其识别为coq了,因为其实在我的repository里有很多verilog被正确的识别了。
在Linguist中有以下描述,
The Language stats bar displays languages percentages for the files in the repository. The percentages are calculated based on the bytes of code for each language as reported by the List Languages API. If the bar is reporting a language that you don't expect: Click on the name of the language in the stats bar to see a list of the files that are identified as that language.
- If you see files that you didn't write, consider moving the files into one of the paths for vendored code, or use the manual overrides feature to ignore them.
- If the files are being misclassified, search for open issues to see if anyone else has already reported the issue. Any information you can add, especially links to public repositories, is helpful.
- If there are no reported issues of this misclassification, open an issue and include a link to the repository or a sample of the code that is being misclassified.
根据其中的第二条,感觉直接找现成的issue比较靠谱,所以直接到linguist中查找相关的内容,果然找到很多啊... 其中Coq / Verilog Misdetections看着蛮接近的,然后点击进去查看,得出结果如下:
根据上述linguist中提到的第一条
If you see files that you didn't write, consider moving the files into one of the paths for vendored code, or use the manual overrides feature to ignore them
可以考虑采用手动override的方式来进行,翻到后续手动覆盖的介绍如下:
Linguist supports a number of different custom overrides strategies for language definitions and vendored paths.
Add a .gitattributes file to your project and use standard git-style path matchers for the files you want to override to set linguist-documentation, linguist-language, and linguist-vendored. .gitattributes will be used to determine language statistics, but will not be used to syntax highlight files. To manually set syntax highlighting, use Vim or Emacs modelines.
$ cat .gitattributes
*.rb linguist-language=Java
根据以上描述,我在azpr_soc下新建了一个.gitattributes的文件,并且将文件内容改为了
*.v linguist-language=Verilog
这个方法也是一个用得比较多的方法,但是使用后效果依旧没有改变...
2016/12/5 早上来看的时候,彩条已经将coq合并到了Verilog中,但是点击Verilog看详细的language的时候,依旧还是coq和verilog分开的,所以这个方法可以说治标不治本,还是研究研究怎么区分coq和verilog比较好~~
详细关于coq的说明可以参考网站 : https://coq.inria.fr