LoginSignup
23

More than 5 years have passed since last update.

MacでJavaScriptのステップ数をカウントする

Last updated at Posted at 2015-03-15

Macでステップ数をカウントする"Ohcount"が使えそうなのでメモ.
Ohcount

ライセンスの下調べもできる.

環境

  • Mac OS X Yosemite
  • Homebrew 0.9.5
  • ohcount 3.0.0

インストール

homebrewがあれば簡単.

$brew install ohcount

使い方

ヘルプ

$ohcount --helpでヘルプが出る.

サマリ表示

カウントしたいフォルダで実行すると,言語別にカウントしたサマリを出力する.
集計結果が表組みで出力されて分かりやすい.
コメント率も出るので親切な印象.

出力結果から見ると,ohcount -sと同じ効果.

$cd /countTarger
$ohcount
Examining 451 file(s)

                          Ohloh Line Count Summary                          

Language          Files       Code    Comment  Comment %      Blank      Total
----------------  -----  ---------  ---------  ---------  ---------  ---------
javascript          175      28213      14452      33.9%       7568      50233
cpp                   6       3392        356       9.5%        596       4344
make                 11        873        316      26.6%        255       1444
python                2        562        316      36.0%        146       1024
xml                   2        139          8       5.4%         16        163
html                  1         10          0       0.0%          0         10
----------------  -----  ---------  ---------  ---------  ---------  ---------
Total               197      33189      15448      31.8%       8581      57218

ファイル別にカウント

ohcount -iで個別のステップ数を返す.

Examining 451 file(s)
                              Ohloh Line Count                              
Language               Code    Comment  Comment %      Blank      Total  File
----------------  ---------  ---------  ---------  ---------  ---------  ----------------------------------
javascript                2          3      60.0%          1          6  browser.js
javascript              293         88      23.1%        114        495  index.js
javascript               60          9      13.0%         21         90  register.js
javascript              999         39       3.8%         85       1123  async.js

...

javascript               31          0       0.0%          0         31  tinycolor.js
cpp                     100          5       4.8%         12        117  bufferutil.cc
cpp                     112         11       8.9%         22        145  validation.cc
xml                     111          8       6.7%         16        135  pom.xml

ライセンスを調べる

ohcount -lでソースコード中のライセンスを解析してくれる.
該当するライセンスが不明な場合は,出力結果に表示されない.

試した範囲ではmit, gpl, lgplを判別している.

$ohcount -l

lgpl index.js
mit async.js
lgpl index.js
mit es6-promise.js
mit es6-promise.min.js
lgpl Endpoint.js
lgpl Filter.js
lgpl Hub.js
lgpl index.js

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
23