ruby - 在 VSCode 终端中在 Win 10 上运行 rake 任务会添加一个默认的 -w 标志
问题描述
我不完全确定这是如何发生的或如何更改设置,但现在当我运行
rake <name_of_task>
可执行文件显示了这一点:
C:/Ruby30-x64/bin/ruby.exe -w -I"lib" C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb "<the dir of the test and filename>"
...然后似乎给 Ruby.exe 命令标志-w
,它在终端中将代码格式化警告显示为 STDout,例如:
warning: mismatched indentations at 'end' with 'def' at 8
这一切都很好,因为它是 STDout,所以它不会写入我们的日志,但它会使 VScode 终端中的调试变得疯狂,因为现在有 100 条这样的警告。
更奇怪的是,当我的同事运行相同的代码时,他们现在得到的输出相同。除非 Rake 中存在错误,否则我不确定这怎么可能?
另一件事是,当您运行直接 ruby 测试(使用 minitest)时,它根本不会显示此输出。那么有没有其他人使用rake-13.0.3
gem 看到过这个?
解决方案
好吧 - 想通了。
rake
默认warning
为true
,向 Ruby 可执行文件添加一个-w
标志。
如何修复的示例:
Rake::TestTask.new("<task_name>") do |t|
t.test_files = FileList["test/<file.rb>"]
t.warning = false <-- must be false to remove -w flag
end
推荐阅读
- r - 快速访问矩阵元素,其中索引由其他矩阵给出
- c - 在结构中重新排列指针不会给我正确的结果
- angularjs - 使用 AngularJS 从 Ajax 调用中删除 Referer 标头
- sql-server - “值不能为空。参数名称:reportedElement”将新的 Always Encrypted 列添加到现有表时
- php - 在结帐前更改购物车项目订阅属性值
- python - 如何在没有“while True”循环的情况下绘制这个对数?
- python - 从文本文件中读取 python 列表
- web-scraping - IMPORTHTML / 表拉问题
- php - 从带有换行符的字符串中删除最后一个逗号
- reactjs - 我是否必须从导入和添加到库中重新列出所有 React Font Awesome 图标?