gitgithubgithub-linguist

linguist-vendored and linguist-language not working in .gitattributes file


I am trying to use .gitattributes to specify the language of all .h files using linguist-language=C and make sure linguist doesn't include the SFML library in its tally using linguist-vendored. I counted up all the lines in my project (without the library of course) and the total amount of lines is 529. I counted all the lines in my .c and Makefile files (not the .h files) and they total to 31 lines. I'm no mathematician, but the .c and Makefile files make up roughly 5% of my project, yet after committing the .gitattributes file specifying not to count the include files, it says that C++ makes up 99.7% of my project, when it should be roughly 95. I don't know what the problem is. Here is the .gitattributes file:

*.h linguist-language=C
./include/SFML/* linguist-vendored

and here is the link to the GitHub repo: https://github.com/reimeytal/pandemic-simulator Any help is appreciated. Thanks.


Solution

  • Linguist doesn't count the lines of code for each language, but the bytes.


    Source. From Linguist's README:

    The result of this analysis is used to produce the language stats bar which displays the 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.