yml文件中的Rubocop“意外令牌tCOLON”错误

时间:2016-05-24 20:33:36

标签: ruby-on-rails ruby yaml lint rubocop

运行Rubocop时,我在config文件夹下的所有yml文件都会出现此错误。

示例:

config/database.yml:1:8: E: unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
default: &default
       ^
config/database.yml:2:10: E: unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
  adapter: postgresql
         ^
config/database.yml:3:11: E: unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
  encoding: unicode
          ^
config/database.yml:4:7: E: unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
  pool: 5
      ^

这是我的database.yml文件:

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5

development:
  <<: *default
  database: otimicar_development

test:
  <<: *default
  database: otimicar_test

这意味着什么?其他文件如secrets.yml也会产生同样的错误...

0 个答案:

没有答案
相关问题