LoginSignup
5
4

More than 5 years have passed since last update.

【Atom】linter-rubyが日本語文字列に「unexpected end-of-input, expecting keyword_end」という

Last updated at Posted at 2017-04-10

事象

これと同じように、日本語文字列がError扱いになっている。
https://teratail.com/questions/61253

原因

linter-rubyが、うまくファイルをUTF-8で読み込んでいないらしいとのこと。(対応Rubyが古いらしい)
https://github.com/AtomLinter/linter-ruby/issues/103
バグはしばらく直りそうにない。

対応

明示的にUTF-8で読み込むオプションを付与したコマンドを作成し、linter-rubyではそれを呼ぶようにする。

1. コマンド作成

下記をPATHの中に設置。実行権限を付与する。(rubyのパスは適宜)
自分はruby-kuにした。

#!/bin/bash
exec /usr/local/var/rbenv/shims/ruby -Ku "$@"

試しにruby-ku -vと打って、バージョンが出力されたらOK。

2. linter-rubyに設定

Ruby Executable Pathに、作成したコマンド名を入力
スクリーンショット 2017-04-10 13.11.52.png

エラーが出てたファイルを開き直し、エラーが消えていれば完了。

補足

  • 作成コマンドだとruby: warning: -K is specified; it is for 1.8 compatibility and may cause odd behaviorという警告が出ますが無視。Eutf-8オプションでは効かなかった・・・
5
4
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
5
4