`rake new_cop`タスクのバグ修正などした

RuboCop で新しい cop を作るときのジェネレータとして、RuboCop は rake new_cop というタスクを備えている。先日 cop を作る際にそのタスクのバグを踏んでいたので、再現ケースを作って直していたりした。

github.com

参考として rake new_cop を使って Lint/UriEscapeUnescape cop のベースを zsh で作る時は以下となる。

% bundle exec rake new_cop\[Lint/UriEscapeUnescape\]
Files created:
  - lib/rubocop/cop/lint/uri_escape_unescape.rb
  - spec/rubocop/cop/lint/uri_escape_unescape_spec.rb

Do 3 steps:
  1. Add an entry to the "New features" section in CHANGELOG.md,
     e.g. "Add new `UriEscapeUnescape` cop. ([@your_id][])"
  2. Add an entry into config/enabled.yml or config/disabled.yml
  3. Implement your new cop in the generated file!