https://github.com/r7kamura/code_hunter
Railsのコードを静的解析して指摘してくれるツールをつくりました。
使い方
Ruby 1.9 があれば使えます。
$ gem install code_hunter
$ code_hunter --help
Usage: code_hunter [options]
--application-path= (default: ./) rails application root path
--format= (default: yaml) output format (yaml or json)
--no-brakeman (default: false) disable brakeman
--no-pendaxes (default: false) disable pendaxes
--no-rails-best-practices (default: false) disable rails-best-practices
実行すると標準出力で色々指摘されます。
デフォルトの出力形式はYAMLで、JSONも選択出来ます。
$ code_hunter
...
...
---
- :service: brakeman
:line: 8
:path: config/routes.rb
:message: All public methods in controllers are available as actions in routes.rb
near line 8
:sha1: 81887a2fb6efaa9dae59425ce7537c7905516ed0
:author: Ryo Nakamura
:email: r7kamura@gmail.com
:modified_at: 1357783853
- :service: rails_best_practices
:line: 9
:path: config/routes.rb
:message: ! 'restrict auto-generated routes examples (only: [])'
:sha1: 81887a2fb6efaa9dae59425ce7537c7905516ed0
:author: Ryo Nakamura
:email: r7kamura@gmail.com
:modified_at: 1357783853
川
https://github.com/r7kamura/code_hunter_dashboard
解析結果を保存して意識を高めるためのアプリもつくりました。
Github上のcommitを参照したり、警告に関するブログエントリを見たり、己の業を一覧したり出来ます。