首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >github-语言学家在语言统计中包含具有语言学家提供属性的文件

github-语言学家在语言统计中包含具有语言学家提供属性的文件
EN

Stack Overflow用户
提问于 2021-09-25 23:48:31
回答 1查看 98关注 0票数 1

我有一个github存储库,它主要是C++的,但有许多供应商生成的C代码(微控制器的驱动程序),完全抛出了语言统计数据。我已经阅读了this page,并在我的存储库中创建了一个.gitattributes文件,它应该将所有这些驱动程序文件标记为linguist-vendored,并防止它们被包括在统计数据中。尽管git check-attr报告linguist-vendored属性已设置,但github-linguist命令行工具仍会忽略这一点。我做错了什么?

代码语言:javascript
复制
$ cat .gitattributes
STM32[[:space:]]Code/*/** linguist-vendored
STM32[[:space:]]Code/*/Core/Src/** -linguist-vendored
STM32[[:space:]]Code/*/Core/Inc/** -linguist-vendored

$ git add .gitattributes
$ git commit --amend --no-edit
[master 017861e] fix github language metrics
 Date: Sat Sep 25 16:09:00 2021 -0700
 1 file changed, 3 insertions(+)
 create mode 100644 .gitattributes

$ git check-attr -a "STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c"
STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c: linguist-vendored: set

$ github-linguist --breakdown
94.75%  C
2.92%   C++
2.09%   Makefile
0.23%   Assembly
0.01%   Shell

...
C:
STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c
...

我还尝试将.gitattributes文件更改为

代码语言:javascript
复制
STM32[[:space:]]Code/** linguist-vendored

而且它仍然不会忽略里面的文件。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-27 08:42:09

我怀疑你使用的可能是旧版本的Linguist和/或rugged (这是用来检查gitattributes的);可能是你的操作系统附带的版本,因为我不能用GitHub正在使用的最新版本重现你的行为:

代码语言:javascript
复制
$ gem install github-linguist
Fetching github-linguist-7.16.1.gem
Building native extensions. This could take a while...
Successfully installed github-linguist-7.16.1
1 gem installed
$ git init foo
Initialized empty Git repository in /Users/lildude/Downloads/trash/foo/.git/
$ mkdir -p "foo/STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/"
$ echo "foo" > "foo/STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c"
$ cd foo
$ git add .
$ git commit -m 'Initial commit'
$ github-linguist . --breakdown
100.00% 4          C

C:
STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c

$ echo "STM32[[:space:]]Code/*/** linguist-vendored" > .gitattributes
$ git add .gitattributes
$ git commit -m 'overwrite'
[main 15e0a4e] overwrite
 1 file changed, 1 insertion(+)
 create mode 100644 .gitattributes
$ github-linguist . --breakdown


$
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69330846

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档