3

我将 flycheck 模式与 rubocop 检查器一起使用。

当我打开一些 rb 文件时,

Checker ruby-rubocop returned non-zero exit code 1, but no errors from output: /Users/abc/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:2157:in `method_missing': undefined method `this' for #<Gem::Specification:0x3fc38c8edb10 rubocop-0.35.1> (NoMethodError)
    from /Users/abc/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1056:in `find_active_stub_by_path'
    from /Users/abc/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:63:in `require'
    from /Users/abc/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/bin/rubocop:6:in `<top (required)>'
    from /Users/abc/.rvm/gems/ruby-2.2.3/bin/rubocop:23:in `load'
    from /Users/abc/.rvm/gems/ruby-2.2.3/bin/rubocop:23:in `<main>'
    from /Users/abc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
    from /Users/abc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'

Checker definition probably flawed.

而且flycheck模式不起作用

我也使用弹丸/弹丸轨道模式。但是某些项目的 rb 文件不会引发错误。某些项目发生错误。

4

3 回答 3

1

如果没有看到它在命令行上运行,很难告诉你发生了什么。

我遇到了同样的错误,结果发现我使用的是旧版本的 Rubocop,并且 FlyCheck 正在rubocop使用它不理解的选项调用可执行文件 ( --display-cop-names)。

所以从命令行运行它,并发布结果,然后我们可以尝试诊断问题。

于 2016-05-06T18:44:13.823 回答
0

我不知道为什么,但之后:

$ rubocop --auto-gen-config

在我的 Rails APP_ROOT 中,现在一切正常。

于 2020-09-05T18:11:35.967 回答
0

对于它的价值,我看到了这个:

/Users/alexmoore-niemi/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2158:in `method_missing': undefined method `this' for #<Gem::Specification:0x3fce0dc538dc rubocop-0.47.1> (NoMethodError)
    from /Users/alexmoore-niemi/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:1057:in `find_active_stub_by_path'
    from /Users/alexmoore-niemi/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:64:in `require'
    from /Users/alexmoore-niemi/.rvm/gems/ruby-2.3.0/gems/rubocop-0.47.1/bin/rubocop:6:in `<top (required)>'
    from /Users/alexmoore-niemi/.rvm/gems/ruby-2.3.0/bin/rubocop:23:in `load'
    from /Users/alexmoore-niemi/.rvm/gems/ruby-2.3.0/bin/rubocop:23:in `<main>'
    from /Users/alexmoore-niemi/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/alexmoore-niemi/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

但这个问题只出现在我的一个项目中;rubocop在另一个项目中执行得很好!

所以我卸载了 rubocop,运行gem update --system,然后重新安装它,它在两个项目中再次运行。

于 2017-01-30T16:19:25.103 回答