LoginSignup
16
16

More than 5 years have passed since last update.

bugspots を実際に利用してみて

Posted at

bugspotsについて

igrigorik/bugspots
グーグルのバグ予測アルゴリズムを実装したツール「bugspots」について
グーグルのバグ予測アルゴリズムを実装したツール「bugspots」、オープンソースで公開 - Publickey
上記記事が参考になります。

面白そうだし、品質あがるのであればやってみたい、やってみよう。

やってみるぞ

導入の仕方は、READMEに書いてある通りで動くので割愛。

実行。go。

$bugspots .
Scanning . repo
        Found 1234 bugfix commits, with 1234 hotspots:

        Fixes:
                - fix a comment
                - Fixed index hogehoge
        Hotspots:
                0.8875 - Gemfile.lock
                0.8478 - Gemfile
                0.7712 - app/controllers/hoges_controller.rb
                0.3702 - app/views/hoges/index.text.slim

日本語でコミットメッセージ書いていると。。

スコアリングの数式の中で、 【バグフィックスのコミット回数】を使用しているのですが、その判定が、デフォルトでは、commit messageに fix(es|ed) close(s|d) が含まれるか否か、になっています。

bugspots/scanner.rb at master · igrigorik/bugspots

  def self.scan(repo, branch = "master", depth = 500, regex = nil)
    regex ||= /\b(fix(es|ed)?|close(s|d)?)\b/i

日本語commit messageが許されている環境であれば、ここの指定方法を多少いじってあげた方が良さそうです。

$bugspots . -w 修正

もしくは、

$bugspots . --words ["修正,fix,bug"]

で、バグフィックスコメントの対象の指定を変える事ができます。

または

$bugspots -r "fix(es|ed)?"

で、正規表現も使えるようです。

対象branchは、デフォルト master

例え、現在いるbranchが何であろうと、実際にbugspotsが走査するのは、デフォルトだとmaster branchのようです。

bugspots/bugspots at master · igrigorik/bugspots

# Set master as the default branch
options[:branch] ||= "master"

そのため master branchがなければ、

lib/bugspots/scanner.rb:13:in `scan': no such branch in the repo: master (ArgumentError)

こんなエラーがでます。

もしくは、branchを明示的に指定してあげれば平気そう

bugspots /path/to/git/repo -b develop

感想

  • commit messageの指定は、日本語が混ざる場合、工夫が必要そう
  • 直近の開発がスコアが高くなるので、新機能開発をしているフェイズでは、スコアリングに偏りが出やすい
    • それを認識した上で、「ここすげー古い機能なのに、スコア高いぞ」とかはありかも
  • 面白い
16
16
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
16
16