在我的RSpec pry
中要求spec_helper.rb
并运行我的规范会给我一些警告。我如何摆脱这些?
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/commands/bang.rb:3: warning: ambiguous first argument; put parentheses or even spaces
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/commands/cat/file_formatter.rb:54: warning: assigned but unused variable - ext
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/commands/ls/formatter.rb:43: warning: method redefined; discarding old grep
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pry_class.rb:22: warning: `*' interpreted as argument prefix
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:42: warning: `*' interpreted as argument prefix
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:172: warning: method redefined; discarding old memory_size
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/config/convenience.rb:22: warning: previous definition of memory_size was here
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:176: warning: method redefined; discarding old memory_size=
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/config/convenience.rb:23: warning: previous definition of memory_size= was here
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:602: warning: method redefined; discarding old pager
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/config/convenience.rb:22: warning: previous definition of pager was here
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:609: warning: method redefined; discarding old output
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/config/convenience.rb:22: warning: previous definition of output was here
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pager.rb:41: warning: private attribute?
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/docstring.rb:175: warning: assigned but unused variable - open_parens
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/docstring.rb:176: warning: assigned but unused variable - close_parens
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/docstring_parser.rb:118: warning: character class has duplicated range: /\A[\r\n\s]+|[\r\n\s]+\Z/
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/docstring_parser.rb:138: warning: assigned but unused variable - tag_klass
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/tags/library.rb:236: warning: assigned but unused variable - arity
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/docstring_parser.rb:118: warning: character class has duplicated range: /\A[\r\n\s]+|[\r\n\s]+\Z/
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/logging.rb:179: warning: instance variable @progress_msg not initialized
/Library/Ruby/Gems/2.0.0/gems/yard-0.8.7.4/lib/yard/logging.rb:179: warning: instance variable @progress_msg not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/commands/whereami.rb:140: warning: instance variable @method_code not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/code.rb:267: warning: instance variable @with_indentation not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/code.rb:267: warning: instance variable @with_indentation not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/code.rb:267: warning: instance variable @with_indentation not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/code.rb:267: warning: instance variable @with_indentation not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/code.rb:267: warning: instance variable @with_indentation not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pager.rb:136: warning: instance variable @system_pager not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pager.rb:185: warning: instance variable @pager not initialized
/Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/pager.rb:185: warning: instance variable @pager not initialized
答案 0 :(得分:3)
从--warning
文件中删除.rspec
选项。
答案 1 :(得分:0)
如果项目中没有.rspec
文件或.rspec
文件没有--warning
选项,则您需要打开spec/spec_helper.rb
并设置config.warnings = false
}。
尽量避免暂存.rspec
文件,而是将所有RSpec配置放在spec_helper.rb
中。开发人员应该使用.rspec
覆盖任何基本配置,以便他们可以按照首选方式运行RSpec(例如,警告,颜色,随机顺序等等,如果项目设置尚未将其配置为他们的喜欢已经)。