Faker 2.2.2 がリリースされた。含まれている自分のパッチは以下。
先日実装した RuboCop Faker を使った auto-correct で Faker 2 スタイルに移行するためのコマンドをコピペで実施できるようにしている。これは FactoryBot から得たアイデア。
% cat example.rb require 'faker' Faker::Lorem.words(10000, true) % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `words` is deprecated. Use keyword argument like `words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `words` is deprecated. Use keyword argument like `words(supplemental: ...)` instead. To automatically update from positional arguments to keyword arguments, install rubocop-faker and run: rubocop \ --require rubocop-faker \ --only Faker/DeprecatedArguments \ --auto-correct
bundle update
したら Faker 2.0 の破壊的変更によるエラーに遭遇して、それを upstream で緩和できないかと思ってからの一連のサーガは以下。
- Faker 2 実行時に古い positional arguments スタイルを使っている時に動的に警告を出すようパッチを書いた http://koic.hatenablog.com/archive/2019/08/28
- Faker 2 の keyword arguments スタイルに auto-correct する RuboCop Faker を実装してリリースした http://koic.hatenablog.com/entry/rubocop-faker-has-been-released
- Faker 2 実行時の警告に RuboCop Faker を使った auto-correct を示すようパッチにして打診して取り込まれた (今回)
こういったパッチを送ったりコードを書いたりして Faker の org メンバーに招待されたのが昨日のパッチ会の最中だった。
Faker の org メンバーになりました。https://t.co/V0AA6g3S56
— Koichi ITO (@koic) 2019年9月5日
現在、Faker 2.2.2 ではこれらのパッチが適用されているので、Faker 2 への一連の動きとしては落ち着いたと思う。今後はもしかすると Faker 3 でインターフェースが変わる可能性がなくはないので、そのときはアップグレードしやすい仕組みを導入しておけるマイルストーンをあとで提案しようと思っている。