github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.22k stars 4.22k forks source link

I cannot get github-linguist to play nicely to save my life #4490

Closed ghost closed 5 years ago

ghost commented 5 years ago

I tried vendoring JS code, does not work. Tried this:

.gitattributes:

alexhultman@alexhultman-N56VZ:~/uWebSockets.js$ cat .gitattributes
*.js linguist-language=C++

Get this classification:

alexhultman@alexhultman-N56VZ:~/uWebSockets.js$ github-linguist
78.13%  C++
15.02%  JavaScript
3.93%   Makefile
2.92%   QMake

Makes no sense

lildude commented 5 years ago

What's wrong with the template we provide when opening an issue? 😭 Your question is answered in the documentation referenced in the first four points.

I tried vendoring JS code, does not work. Makes no sense

Assuming you've committed your .gitattributes to the repo, your output shows it is forcing all .js files to be identified as C++ and not vendored so the analysis makes perfect sense 😄.

Point three in the template:

  • [ ] considered implementing an override

... has the answer you're looking for vendoring 😉.

ghost commented 5 years ago

Your link to overrides points to the very section of the documentation I have followed like a slave in 8 different commits and locally, to no success.

Override section includes what I have in my issue comment

lildude commented 5 years ago

What about like you've done before: https://github.com/uNetworking/uWebSockets.js/blob/master/.gitattributes ?

ghost commented 5 years ago

That's where I started.

alexhultman@alexhultman-N56VZ:~/uWebSockets.js$ ls -a | grep .gitattributes
.gitattributes
alexhultman@alexhultman-N56VZ:~/uWebSockets.js$ cat .gitattributes 
*.js linguist-vendored
alexhultman@alexhultman-N56VZ:~/uWebSockets.js$ github-linguist
78.13%  C++
15.02%  JavaScript
3.93%   Makefile
2.92%   QMake
lildude commented 5 years ago

Works for me:

$ github-linguist --breakdown
78.13%  C++
15.02%  JavaScript
3.93%   Makefile
2.92%   QMake

Makefile:
Makefile
tests/Makefile

QMake:
misc/addon.pro
misc/host.pro

C++:
src/AppWrapper.h
src/HttpRequestWrapper.h
src/HttpResponseWrapper.h
src/Utilities.h
src/WebSocketWrapper.h
src/addon.cpp
src/host.cpp

JavaScript:
src/uws.js
tests/Autobahn.js
tests/Hammer.js

$ /bin/cat .gitattributes

examples/* linguist-vendored
$ echo "*.js linguist-vendored" >! .gitattributes
$ git add .gitattributes
$ git commit -m 'Vendor JS'
[master 189786d] Vendor JS
 1 file changed, 1 insertion(+), 2 deletions(-)
$ github-linguist --breakdown                   
91.94%  C++
4.62%   Makefile
3.43%   QMake

Makefile:
Makefile
tests/Makefile

QMake:
misc/addon.pro
misc/host.pro

C++:
src/AppWrapper.h
src/HttpRequestWrapper.h
src/HttpResponseWrapper.h
src/Utilities.h
src/WebSocketWrapper.h
src/addon.cpp
src/host.cpp

$

And visible on my fork - https://github.com/lildude/uWebSockets.js

ghost commented 5 years ago

When it works it works. Thanks. My local github-linguist still won't move an inch.