小编fed*_*est的帖子

Rails:rubocop disable Class有太多行错误

我有一个常量,很多常量的类.而且rubocop正在抱怨这个课程的长度,我不在乎它会花多长时间.

我想禁用rubocop的错误:"类有太多行"但以下是行不通的:

# rubocop:disable ClassLength
Run Code Online (Sandbox Code Playgroud)

编辑:此外,以下不是:

# rubocop:disable Metrics/ClassLength
Run Code Online (Sandbox Code Playgroud)

我需要禁用的正确指标是什么?

ruby-on-rails rubocop

17
推荐指数
4
解决办法
1万
查看次数

CMake Gcov C ++创建错误的.gcno文件

我在其中添加了CMakeLists.txt文件:

set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -pthread -std=c++11 -O0 ${CMAKE_CXX_FLAGS}")
Run Code Online (Sandbox Code Playgroud)

它在以下位置生成报告文件:

project_root/build/CMakeFiles/project.dir/
Run Code Online (Sandbox Code Playgroud)

但是生成的文件具有扩展名.cpp.gcno.cpp.gcda并且.cpp.o

此外,它们与src文件不在同一文件夹中,这些文件位于:

project_root/src/ 
Run Code Online (Sandbox Code Playgroud)

当我将报告文件移到src /文件夹并执行时

$ gcov main.cpp
main.gcno:cannot open notes file
Run Code Online (Sandbox Code Playgroud)

但我收到该错误消息。所以我改变.cpp.gcno.cpp.cdna并且cpp.o.gcno.gcda以及.o最后我得到如下:

gcov main.cpp
Lines executed:86.67% of 15
Creating 'main.cpp.gcov'
Run Code Online (Sandbox Code Playgroud)

我有50多个文件,不能为每个文件手动进行。

我需要能够对所有文件运行一次gcov并为所有文件生成报告。我不在乎文件在哪里生成。

c++ cmake gcov

5
推荐指数
2
解决办法
6416
查看次数

rails s Rack 应用程序错误处理请求 { GET / } 在 Windows 上

我在 Mac 和 Windows 上运行相同的应用程序。当我在 mac 上启动服务器时,它运行正常,当我尝试在 Windows 上运行它时,出现以下错误:

2018-07-30 20:35:30 -0300: Rack app error handling request { GET / }
#<Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - user specified timeout>
C:/Ruby24-x64/lib/ruby/2.4.0/socket.rb:61:in `connect_internal'
C:/Ruby24-x64/lib/ruby/2.4.0/socket.rb:137:in `connect'
C:/Ruby24-x64/lib/ruby/2.4.0/socket.rb:627:in `block in tcp'
C:/Ruby24-x64/lib/ruby/2.4.0/socket.rb:227:in `each'
C:/Ruby24-x64/lib/ruby/2.4.0/socket.rb:227:in `foreach'
C:/Ruby24-x64/lib/ruby/2.4.0/socket.rb:617:in `tcp'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/webpacker-3.0.1/lib/webpacker/dev_server.rb:9:in `running?'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/webpacker-3.0.1/lib/webpacker/dev_server_proxy.rb:7:in `rewrite_response'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rack-proxy-0.6.2/lib/rack/proxy.rb:57:in `call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/puma-3.10.0/lib/puma/configuration.rb:225:in `call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/puma-3.10.0/lib/puma/server.rb:605:in `handle_request' …
Run Code Online (Sandbox Code Playgroud)

windows rack ruby-on-rails

5
推荐指数
0
解决办法
1496
查看次数

如何在Cmake中使用gcov

我有困难按照本指南(我在其他帖子上看到推荐)的问题https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake

第一:

将此文件复制到cmake模块路径中.

我怎么知道我的cmake模块路径是什么?

使用函数SETUP_TARGET_FOR_COVERAGE创建自定义make目标

这究竟是什么意思?我怎么做?特别是,我需要输入什么以及在哪里?

我被迫用cmake编译应用程序,否则我会用gcc来编译它.

c++ cmake gcov

4
推荐指数
1
解决办法
6952
查看次数

Rails 低级缓存在开发模式下不起作用

我已经像这样配置了 development.rb 文件:

# Enable/disable caching. By default caching is disabled.
config.action_controller.perform_caching = true

config.cache_store = :memory_store
config.public_file_server.headers = {
  'Cache-Control' => 'public, max-age=172800'
}
Run Code Online (Sandbox Code Playgroud)

(删除检查文件的默认配置只是为了测试)

然后我打开一个rails console来测试这个,但它似乎不起作用:

[1] pry(main)> Rails.cache.write("asd", "asd")
=> true
[2] pry(main)> Rails.cache.read("asd")
=> nil
Run Code Online (Sandbox Code Playgroud)

几天前我设法让它工作,但现在它不起作用。

AI 遗漏了什么?

caching ruby-on-rails

4
推荐指数
2
解决办法
1202
查看次数

标签 统计

ruby-on-rails ×3

c++ ×2

cmake ×2

gcov ×2

caching ×1

rack ×1

rubocop ×1

windows ×1