0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Rubocopを使って、Rubyのマジックコメントを coding: utf-8 から frozen_string_literal: true に修正する(一括置換)

Posted at

Rubyのマジックコメントを、# -*- coding: utf-8 -*- から # frozen_string_literal: true に一気に書き換えたい場合、以下の2つのコマンドを流せば、そのディレクトリ以下にあるRubyのすべてのファイルで、マジックコメントが encoding: utf-8 から frozen_string_literal: true に書き換えられる

rubocop --only Style/Encoding -a
rubocop --only Style/FrozenStringLiteralComment -a 

-a オプションを削除して実行すると、ファイルは変更されずに変更箇所のリストアップだけされるので、最初はそれで試してみるのが良いかも

参考

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?