coala / coala-quickstart

A tool that generates an initial coala config file for you!
GNU Affero General Public License v3.0
47 stars 76 forks source link

Language statistics do not add up to 100% #80

Open kaustubhhiware opened 7 years ago

kaustubhhiware commented 7 years ago

I ran coala-quickstart --ci on a project and the language statistics generated were as follows :

The following languages have been automatically detected:
                    C: 37%
               Python:  1%
             Markdown:  1%
                  C++:  0%`

This does not total to 100%. The language statistics for the same project on github were

 C: 97.5%
 Python: 2.3%
 Other: 0.2%

Running linguist locally fetches the following stats :

97.47%  C
2.30%   Python
0.14%   C++
0.09%   Makefile
satwikkansal commented 7 years ago

Related to https://github.com/coala/coala/issues/1079

satwikkansal commented 7 years ago

Fwiw this is the snippet (in ruby) from linguist which we can translate to python

repo.languages.sort_by { |_, size| size }.reverse.each do |language, size|
  percentage = ((size / repo.size.to_f) * 100).round
  puts "%-4s %s" % ["#{percentage}%", language]

https://github.com/github/linguist/blob/4e0b5f02aa5746c69bfea647727bd2c12cd9ebe0/bin/linguist#L30