LoginSignup
10
6

More than 5 years have passed since last update.

GitHubリポジトリの言語比率

Posted at

Githubのトップに表示されている以下のバーはそのリポジトリに於ける言語比率を表していて、バーをクリックすると内訳が表示される

ss_20170426_191917.png

ss_20170426_191925.png

各言語をクリックするとリストが表示される

ss_20170426_191906.png

更新されるタイミング

デフォルトブランチに push されたタイミング
https://help.github.com/articles/about-repository-languages/
Language statistics will update after you push changes to your default branch

後に述べるように、自作したルールやファイルの移動が反映されるかどうかを確認したい場合には

  1. 作業用ブランチを作成
  2. 作業用ブランチをリモートに push
  3. Settings → Branches → Default branch を変更
  4. 作業用ブランチに変更を加える
  5. リモートに push

すると更新されて表示が変更される
デフォルトブランチを切り替えただけだと反映されないので注意

何の比か

Linguist というOSSで計測しているが、このOSSはGithubのList languagesAPIを叩いている
https://github.com/github/linguist

List Language の仕様に書かれているがここで表示されている言語の比率はバイト比になっている
https://developer.github.com/v3/repos/#list-languages
The value on the right of a language is the number of bytes of code written in that language.

Java から Kotlin への置き換えをしている時などに目安にしているのだが、Java に比べて Kotlin はコード量が少なくて済むため進捗に比べてバーが伸びていかない事がある

対象ディレクトリ

ノイズによって意図しない言語が混在する場合には 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.

除外されるディレクトリ
https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml

リポジトリルートの.gitattributesにルールを記述する
https://github.com/github/linguist#overrides

参照

10
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
6